From 054f37b226dfaca8d2b680fa8a437e0fc7cdc447 Mon Sep 17 00:00:00 2001 From: j4nk Date: Wed, 28 Dec 2022 15:18:47 -0500 Subject: [PATCH] Added support for images and links --- md4tj_parse.el | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/md4tj_parse.el b/md4tj_parse.el index 84f6e9f..1e13944 100644 --- a/md4tj_parse.el +++ b/md4tj_parse.el @@ -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 - "\\*\\(.*\\)\\*" - "\\1" + "\\[\\(.*\\)\\](\\(.*\\))" + (concat (md4tj-begin-tag "a" (list '("href" "\\2"))) "\\1" (md4tj-end-tag "a")) + ;; Then images (replace-regexp-in-string - "\\*\\*\\(.*\\)\\*\\*" - "\\1" + "!\\[\\(.*\\)\\](\\(.*\\))" + (md4tj-begin-tag "img" (list '("src" "\\2") '("alt" "\\1"))) + ;; Then emphasis (replace-regexp-in-string - "`\\(.*\\)`" - "\\1" line)))) + "\\*\\(.*\\)\\*" + "\\1" + ;; Then strong + (replace-regexp-in-string + "\\*\\*\\(.*\\)\\*\\*" + "\\1" + ;; First code + (replace-regexp-in-string + "`\\(.*\\)`" + "\\1" line)))))) ;; Note: a "block" is the smallest unit of parsing ;; It is normally a line of the code, but can be