You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
typesetting/quad/quadwriter/markdown.rkt

34 lines
1.1 KiB
Racket

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#lang debug racket/base
(require racket/list
racket/match
quadwriter/core
"tags.rkt"
"lang-helper.rkt")
(provide (all-defined-out)
#%app #%top #%datum #%top-interaction
(all-from-out "tags.rkt"))
(define rsquo "")
(define rdquo "")
(define lsquo "")
(define ldquo "")
(define hellip "")
(define ndash "")
(define mdash "")
(define (doc-proc exprs)
(define strs (match exprs
[(? null?) '(" ")] ; single nonbreaking space, so something prints
[strs strs]))
;; markdown parser returns list of paragraphs
(root null (add-between strs (list pbr)
#:before-first (list pbr)
#:after-last (list pbr)
#:splice? #true)))
(make-module-begin doc-proc)
(module reader racket/base
(require racket/port markdown "lang-helper.rkt")
(provide read-syntax)
(define read-syntax (make-read-syntax 'quadwriter/markdown
(λ (path-string p) (xexpr->parse-tree (parse-markdown (port->string p)))))))