Added strikethrough and highlight syntax
This commit is contained in:
parent
2ad910b5d0
commit
1550094d19
|
@ -22,10 +22,10 @@ A language and parser written in Emacs Lisp for my custom extension of Markdown,
|
|||
- [ ] Footnote (Will not implement)
|
||||
- [ ] Heading ID (Will not implement)
|
||||
- [ ] Definition List (Will not implement)
|
||||
- [ ] Strikethrough
|
||||
- [x] Strikethrough
|
||||
- [ ] Task List (Will not implement)
|
||||
- [ ] Emoji (Will not implement)
|
||||
- [ ] Highlight
|
||||
- [x] Highlight
|
||||
- [ ] Subscript (Will not implement)
|
||||
- [ ] Superscript (Will not implement)
|
||||
|
||||
|
|
|
@ -35,30 +35,38 @@
|
|||
|
||||
(defun md4tj-process-line (line)
|
||||
"Process all inline elements of the LINE, return HTML."
|
||||
;; Finally links
|
||||
;; Finally strikethrough
|
||||
(replace-regexp-in-string
|
||||
"\\[\\([^\\[]*\\)](\\([^\\[]*\\))"
|
||||
(concat (md4tj-begin-tag "a" (list '("href" "\\2"))) "\\1" (md4tj-end-tag "a"))
|
||||
;; Then images
|
||||
"~~\\(.*\\)~~"
|
||||
"<s>\\1</s>"
|
||||
;; Then highlight
|
||||
(replace-regexp-in-string
|
||||
"!\\[\\([^\\[]*\\)](\\([^\\[]*\\))"
|
||||
(md4tj-begin-tag "img" (list '("src" "\\2") '("alt" "\\1")))
|
||||
;; Then videos
|
||||
"==\\(.*\\)=="
|
||||
"<mark>\\1</mark>"
|
||||
;; Then links
|
||||
(replace-regexp-in-string
|
||||
"!!\\[\\([^\\[]*\\)](\\([^\\[]*\\))"
|
||||
(concat (md4tj-begin-tag "video" (list '("src" "\\2") '("type" "video/webm") '("controls" "true"))) "\\1" (md4tj-end-tag "video"))
|
||||
;; Then emphasis
|
||||
(replace-regexp-in-string
|
||||
"\\*\\(.*\\)\\*"
|
||||
"<em>\\1</em>"
|
||||
;; Then strong
|
||||
"\\[\\([^\\[]*\\)](\\([^\\[]*\\))"
|
||||
(concat (md4tj-begin-tag "a" (list '("href" "\\2"))) "\\1" (md4tj-end-tag "a"))
|
||||
;; Then images
|
||||
(replace-regexp-in-string
|
||||
"\\*\\*\\(.*\\)\\*\\*"
|
||||
"<strong>\\1</strong>"
|
||||
;; First code
|
||||
"!\\[\\([^\\[]*\\)](\\([^\\[]*\\))"
|
||||
(md4tj-begin-tag "img" (list '("src" "\\2") '("alt" "\\1")))
|
||||
;; Then videos
|
||||
(replace-regexp-in-string
|
||||
"`\\(.*\\)`"
|
||||
"<code>\\1</code>" line)))))))
|
||||
"!!\\[\\([^\\[]*\\)](\\([^\\[]*\\))"
|
||||
(concat (md4tj-begin-tag "video" (list '("src" "\\2") '("type" "video/webm") '("controls" "true"))) "\\1" (md4tj-end-tag "video"))
|
||||
;; Then emphasis
|
||||
(replace-regexp-in-string
|
||||
"\\*\\(.*\\)\\*"
|
||||
"<em>\\1</em>"
|
||||
;; Then strong
|
||||
(replace-regexp-in-string
|
||||
"\\*\\*\\(.*\\)\\*\\*"
|
||||
"<strong>\\1</strong>"
|
||||
;; First code
|
||||
(replace-regexp-in-string
|
||||
"`\\(.*\\)`"
|
||||
"<code>\\1</code>" line)))))))))
|
||||
|
||||
(defun md4tj-clean-multiline (line)
|
||||
"Clean LINE of markdown syntax for ul."
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
<p><video src="test_video.webm" type="video/webm" controls="true">Example video</video></p>
|
||||
<br/>
|
||||
<ul>
|
||||
<li><p>unordered item 1</p></li>
|
||||
<li><p>unordered item 2</p></li>
|
||||
<li><p>unordered <s>item 1</s></p></li>
|
||||
<li><p>unordered <mark>item 2</mark></p></li>
|
||||
<li><p>unordered item 3</p></li>
|
||||
</ul>
|
||||
<br/>
|
||||
|
@ -46,6 +46,6 @@ int main() {
|
|||
</code>
|
||||
</pre>
|
||||
<br/>
|
||||
Last updated: Wed Jan 4 10:43:05 2023
|
||||
Last updated: Wed Jan 4 11:41:25 2023
|
||||
</body>
|
||||
</html>
|
|
@ -13,8 +13,8 @@
|
|||
![Example image](usbs.png)
|
||||
!![Example video](test_video.webm)
|
||||
|
||||
- unordered item 1
|
||||
- unordered item 2
|
||||
- unordered ~~item 1~~
|
||||
- unordered ==item 2==
|
||||
- unordered item 3
|
||||
|
||||
1. ordered item 1
|
||||
|
|
Loading…
Reference in New Issue