(append
(list
prev
- (funcall function-to-call (subseq (cdr lines) 0 (or pos (length lines)))))
- (parse-lines (nthcdr (1+ pos) (cdr lines))))))
+ (funcall function-to-call (subseq (cdr lines) 0 (or pos (1- (length lines))))))
+ (parse-lines (nthcdr (if pos (1+ pos) (length lines)) (cdr lines))))))
(t (cons prev (parse-lines (cdr lines) parsed-line))))))))
(defun parse-texts (line)
(defline-parser "### *(.*)" inline-h3)
(defline-parser "## *(.*)" inline-h2)
(defline-parser "# *(.*)" inline-h1)
+
+; Ignore codefence
+(defline-parser "(```.*```.*)" default)
+
(defline-parser "```(.*)" codefence)
+
+; If we start with a space after the asterisk, we really do want a list
+(defline-parser " *\\* (.*)" list-item)
+; Ignore list-tiem
+(defline-parser "(\\*\\*.*\\*\\*.*)" default)
+(defline-parser "(\\*.*\\*.*)" default)
(defline-parser " *\\* *(.*)" list-item)
(defline-parser " *" emptiness)
(defline-parser "(.*)" default)
(defun md-link (before text md-link after)
(list before (a :href md-link (parse-texts text)) after))
+(defun inline-code (before during after)
+ (list before (code during) after))
+
(definline-parser "(.*)\\[([^\\]]*)\\]\\(([^)]*)\\)(.*)" md-link)
(definline-parser "(.*)\\*\\*(.*)\\*\\*(.*)" strength)
(definline-parser "(.*)\\*(.*)\\*(.*)" emphasis)
+(definline-parser "(.*)_(.*)_(.*)" emphasis)
+(definline-parser "(.*)```(.*)```(.*)" inline-code)