Added support for images and links
This commit is contained in:
parent
172973926d
commit
054f37b226
|
@ -34,15 +34,26 @@ f;;; md4tj_parse --- Summary
|
|||
|
||||
(defun md4tj-process-line (line)
|
||||
"Process all inline elements of the LINE, return HTML."
|
||||
;; Finally links
|
||||
(replace-regexp-in-string
|
||||
"\\*\\(.*\\)\\*"
|
||||
"<em>\\1</em>"
|
||||
"\\[\\(.*\\)\\](\\(.*\\))"
|
||||
(concat (md4tj-begin-tag "a" (list '("href" "\\2"))) "\\1" (md4tj-end-tag "a"))
|
||||
;; Then images
|
||||
(replace-regexp-in-string
|
||||
"\\*\\*\\(.*\\)\\*\\*"
|
||||
"<strong>\\1</strong>"
|
||||
"!\\[\\(.*\\)\\](\\(.*\\))"
|
||||
(md4tj-begin-tag "img" (list '("src" "\\2") '("alt" "\\1")))
|
||||
;; Then emphasis
|
||||
(replace-regexp-in-string
|
||||
"`\\(.*\\)`"
|
||||
"<code>\\1</code>" line))))
|
||||
"\\*\\(.*\\)\\*"
|
||||
"<em>\\1</em>"
|
||||
;; Then strong
|
||||
(replace-regexp-in-string
|
||||
"\\*\\*\\(.*\\)\\*\\*"
|
||||
"<strong>\\1</strong>"
|
||||
;; First code
|
||||
(replace-regexp-in-string
|
||||
"`\\(.*\\)`"
|
||||
"<code>\\1</code>" line))))))
|
||||
|
||||
;; Note: a "block" is the smallest unit of parsing
|
||||
;; It is normally a line of the code, but can be
|
||||
|
|
Loading…
Reference in New Issue