Source

lowdown / lowdown-extra.scm

(module lowdown-extra

(enable-lowdown-extra!
 inline-note
 lowdown-extra-html-conversion-rules*)

(import chicken scheme)
(use comparse lowdown lowdown-lolevel clojurian-syntax)

(define inline-note
  (enclosed-by (char-seq "^[")
               (->> (none-of* (is #\]) inline)
                    (one-or-more)
                    (node 'inline-note))
               (char-seq "]")))

(define lowdown-extra-html-conversion-rules*
  `((inline-note . ,(lambda (_ contents)
                      `(span (@ (class "note")) . ,contents)))))

(define (enable-lowdown-extra!)
  (inline-hook (cons inline-note (inline-hook)))
  (markdown-html-conversion-rules*
   (append lowdown-extra-html-conversion-rules*
           (markdown-html-conversion-rules*)))
  (void))

)