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

#lang debug racket/base
5 years ago
(require racket/list
5 years ago
racket/match
quadwriter/core
5 years ago
"tags.rkt"
5 years ago
"lang-helper.rkt")
(provide (all-defined-out)
5 years ago
#%app #%top #%datum #%top-interaction
5 years ago
(all-from-out "tags.rkt"))
5 years ago
(define rsquo "")
(define rdquo "")
(define lsquo "")
(define ldquo "")
(define hellip "")
(define ndash "")
(define mdash "")
5 years ago
(define (doc-proc exprs)
(define strs (match exprs
5 years ago
[(? null?) '(" ")] ; single nonbreaking space, so something prints
5 years ago
[strs strs]))
5 years ago
;; markdown parser returns list of paragraphs
5 years ago
(root null (add-between strs (list pbr)
#:before-first (list pbr)
#:after-last (list pbr)
#:splice? #true)))
5 years ago
(make-module-begin doc-proc)
5 years ago
(module reader racket/base
5 years ago
(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)))))))