Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions markdown/parse.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
(contract-out
[read-markdown (->* () (symbol?) xexpr-element-list?)]
[parse-markdown (->* ((or/c string? path?)) (symbol?) xexpr-element-list?)]
[current-strict-markdown? parameter/c]))
[current-strict-markdown? parameter/c]
[current-non-scribble-entity-handler parameter/c]))

(module+ test
(require rackunit))
Expand Down Expand Up @@ -141,6 +142,12 @@

;; Parameter to limit us to strict markdown (no customizations).
(define current-strict-markdown? (make-parameter #f))
;; Parameter to limit us to generating only pre-content? entities
;; "A symbol content is either 'mdash, 'ndash, 'ldquo, 'lsquo, 'rdquo,
;; 'rsquo, 'larr, 'rarr, or 'prime; ..."
;; others (e.g. hellip) either need to not be given to scribble, or given
;; as UTF-8 characters (possibly breaking Latex)
(define current-non-scribble-entity-handler (make-parameter values))
;; A parser to make use of the parameter.
(define unless-strict (curry parse-unless current-strict-markdown?))

Expand Down Expand Up @@ -387,7 +394,7 @@

(define $smart-ellipses
(<?> (pdo (oneOfStrings "..." " . . . " ". . ." " . . .")
(return 'hellip))
(return ((current-non-scribble-entity-handler) 'hellip)))
"ellipsis"))

(define $smart-punctuation
Expand Down