add markdown support

pull/9/head
Matthew Butterick 11 years ago
parent 6893426d5d
commit 6a11b78e7d

@ -66,6 +66,7 @@
(cond
[(equal? (string->symbol here-ext) world:ptree-source-ext) world:reader-mode-ptree]
[(equal? (string->symbol here-ext) world:markup-source-ext) world:reader-mode-markup]
[(equal? (string->symbol here-ext) world:markdown-source-ext) world:reader-mode-markdown]
[else world:reader-mode-preproc]))
reader-mode))
@ -76,6 +77,7 @@
;; 'root is the hook for the decoder function.
;; If it's not a defined identifier, it just hits #%top and becomes `(root ,@body ...)
[(equal? parser-mode world:reader-mode-markup) root]
[(equal? parser-mode world:reader-mode-markdown) (compose1 (λ(x) `(root ,@x)) (dynamic-require 'markdown 'parse-markdown) string-append)]
;; for preprocessor output, just make a string.
[else (λ xs (apply string-append (map to-string xs)))])
(cdr doc-without-metas))) ;; cdr strips placeholder-root tag

@ -0,0 +1,4 @@
#lang racket/base
(require pollen/lang/reader-base)
(make-reader-with-mode world:reader-mode-markdown)

@ -6,6 +6,7 @@
(define preproc-source-ext 'pp)
(define markup-source-ext 'pm)
(define markdown-source-ext 'pmd)
(define null-source-ext 'p)
(define ptree-source-ext 'ptree)
(define template-source-ext 'pt)
@ -13,6 +14,7 @@
(define reader-mode-auto 'auto)
(define reader-mode-preproc 'pre)
(define reader-mode-markup 'markup)
(define reader-mode-markdown 'markdown)
(define reader-mode-ptree 'ptree)
(define decodable-extensions (list markup-source-ext ptree-source-ext))

Loading…
Cancel
Save