add toc
This commit is contained in:
parent
ad5cdfb82c
commit
cb261d8290
18
render.rkt
18
render.rkt
|
@ -1,32 +1,36 @@
|
|||
#lang racket
|
||||
|
||||
(require markdown markdown/display-xexpr
|
||||
(require markdown markdown/display-xexpr markdown/toc
|
||||
(prefix-in mathml: "ext-mathml/main.rkt")
|
||||
(prefix-in syntax: "ext-syntax/main.rkt"))
|
||||
|
||||
(define input (port->string (current-input-port)))
|
||||
(define output-raw (parse-markdown input))
|
||||
(define output-cooked (mathml:transform-xexprs (syntax:transform-xexprs output-raw)))
|
||||
(define output-toc (toc output-cooked))
|
||||
|
||||
(define styles (string-append (mathml:get-styles) (syntax:get-styles)))
|
||||
|
||||
(define document
|
||||
`(html
|
||||
((lang "en"))
|
||||
([lang "en"])
|
||||
(head
|
||||
()
|
||||
(meta ((charset "utf-8")))
|
||||
(meta ([charset "utf-8"]))
|
||||
(title () "meow meow meow")
|
||||
(meta ((name "viewport") (content "width=device-width, initial-scale=1")))
|
||||
(meta ((name "description") (content "prototype racket markdown system uwu")))
|
||||
(meta ([name "viewport"] [content "width=device-width, initial-scale=1"]))
|
||||
(meta ([name "description"] [content "prototype racket markdown system uwu"]))
|
||||
;<link rel="shortcut icon" type="image/png" href="haskal.png"/>
|
||||
(style ((type "text/css")) ,styles))
|
||||
(style ([type "text/css"]) ,styles))
|
||||
(body
|
||||
()
|
||||
(nav
|
||||
()
|
||||
,output-toc)
|
||||
(main
|
||||
()
|
||||
,@output-cooked)
|
||||
(div ((style "display: none")) "__X_MATHJAX_POLYFILL_PLACEHOLDER__"))))
|
||||
(div ([style "display: none"]) "__X_MATHJAX_POLYFILL_PLACEHOLDER__"))))
|
||||
|
||||
(display "<!doctype html>")
|
||||
(display-xexpr document)
|
||||
|
|
Loading…
Reference in New Issue