Added strikethrough and highlight syntax

This commit is contained in:
j4nk 2023-01-04 12:07:33 -05:00
parent 2ad910b5d0
commit 1550094d19
4 changed files with 34 additions and 26 deletions

View File

@ -22,10 +22,10 @@ A language and parser written in Emacs Lisp for my custom extension of Markdown,
- [ ] Footnote (Will not implement) - [ ] Footnote (Will not implement)
- [ ] Heading ID (Will not implement) - [ ] Heading ID (Will not implement)
- [ ] Definition List (Will not implement) - [ ] Definition List (Will not implement)
- [ ] Strikethrough - [x] Strikethrough
- [ ] Task List (Will not implement) - [ ] Task List (Will not implement)
- [ ] Emoji (Will not implement) - [ ] Emoji (Will not implement)
- [ ] Highlight - [x] Highlight
- [ ] Subscript (Will not implement) - [ ] Subscript (Will not implement)
- [ ] Superscript (Will not implement) - [ ] Superscript (Will not implement)

View File

@ -35,7 +35,15 @@
(defun md4tj-process-line (line) (defun md4tj-process-line (line)
"Process all inline elements of the LINE, return HTML." "Process all inline elements of the LINE, return HTML."
;; Finally links ;; Finally strikethrough
(replace-regexp-in-string
"~~\\(.*\\)~~"
"<s>\\1</s>"
;; Then highlight
(replace-regexp-in-string
"==\\(.*\\)=="
"<mark>\\1</mark>"
;; Then links
(replace-regexp-in-string (replace-regexp-in-string
"\\[\\([^\\[]*\\)](\\([^\\[]*\\))" "\\[\\([^\\[]*\\)](\\([^\\[]*\\))"
(concat (md4tj-begin-tag "a" (list '("href" "\\2"))) "\\1" (md4tj-end-tag "a")) (concat (md4tj-begin-tag "a" (list '("href" "\\2"))) "\\1" (md4tj-end-tag "a"))
@ -58,7 +66,7 @@
;; First code ;; First code
(replace-regexp-in-string (replace-regexp-in-string
"`\\(.*\\)`" "`\\(.*\\)`"
"<code>\\1</code>" line))))))) "<code>\\1</code>" line)))))))))
(defun md4tj-clean-multiline (line) (defun md4tj-clean-multiline (line)
"Clean LINE of markdown syntax for ul." "Clean LINE of markdown syntax for ul."

View File

@ -26,8 +26,8 @@
<p><video src="test_video.webm" type="video/webm" controls="true">Example video</video></p> <p><video src="test_video.webm" type="video/webm" controls="true">Example video</video></p>
<br/> <br/>
<ul> <ul>
<li><p>unordered item 1</p></li> <li><p>unordered <s>item 1</s></p></li>
<li><p>unordered item 2</p></li> <li><p>unordered <mark>item 2</mark></p></li>
<li><p>unordered item 3</p></li> <li><p>unordered item 3</p></li>
</ul> </ul>
<br/> <br/>
@ -46,6 +46,6 @@ int main() {
</code> </code>
</pre> </pre>
<br/> <br/>
Last updated: Wed Jan 4 10:43:05 2023 Last updated: Wed Jan 4 11:41:25 2023
</body> </body>
</html> </html>

View File

@ -13,8 +13,8 @@
![Example image](usbs.png) ![Example image](usbs.png)
!![Example video](test_video.webm) !![Example video](test_video.webm)
- unordered item 1 - unordered ~~item 1~~
- unordered item 2 - unordered ==item 2==
- unordered item 3 - unordered item 3
1. ordered item 1 1. ordered item 1