Commits

Anonymous committed da87975

Basic inline extension hook and markdown-extra module using it to provide an inline note parser

  • Participants
  • Parent commits 028f272

Comments (0)

Files changed (4)

File lowdown-extra.scm

+(module lowdown-extra
+
+(enable-lowdown-extra! inline-note)
+
+(import chicken scheme)
+(use comparse lowdown-lolevel clojurian-syntax)
+
+(define inline-note
+  (enclosed-by (char-seq "^[")
+               (->> (none-of* (is #\]) inline)
+                    (one-or-more)
+                    (node 'inline-note))
+               (char-seq "]")))
+
+(define (enable-lowdown-extra!)
+  (inline-hook (cons inline-note (inline-hook)))
+  (void))
+
+)

File lowdown-impl.scm

                (cons 'reference-image (cdr link))
                (cons 'image (cdr link)))))))
 
+(define inline-hook
+  (make-parameter '()))
+
+(define (inline-hook-parser input)
+  ((any-of (inline-hook)) input))
+
 (define inline
   (any-of (is #\>)
           (as-string (one-or-more normal-char))
           (emph)
           image
           link
+          inline-hook-parser
           code
           raw-html
           entity

File lowdown-lolevel.scm

 (module lowdown-lolevel
 
-(document inline)
+(inline-hook document inline node)
 
 "lowdown-impl.scm"
 

File lowdown.setup

 
 (compile-lib -X char-set-literals lowdown-lolevel)
 (compile-lib lowdown)
+(compile-lib lowdown-extra)
 
 (install-extension
  'lowdown
  '("lowdown-lolevel.so" "lowdown-lolevel.import.so"
    "lowdown.so" "lowdown.import.so")
  info)
+
+(install-extension
+ 'lowdown
+ '("lowdown-extra.so" "lowdown-extra.import.so")
+ info)