capybara/render.rkt

33 lines
1.0 KiB
Racket

#lang racket
(require markdown markdown/display-xexpr
(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 styles (string-append (mathml:get-styles) (syntax:get-styles)))
(define document
`(html
((lang "en"))
(head
()
(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")))
;<link rel="shortcut icon" type="image/png" href="haskal.png"/>
(style ((type "text/css")) ,styles))
(body
()
(main
()
,@output-cooked)
(div ((style "display: none")) "__X_MATHJAX_POLYFILL_PLACEHOLDER__"))))
(display "<!doctype html>")
(display-xexpr document)