Summary Files Commits Branches @commit @diff @stats
path: root / single.awk
diff options
context:
space:
mode:
Commit622d898e1637d01e14c2e92b913214857c00f901 (patch)
Author
 Syndamia <kamen@syndamia.com>
2024-12-31 15:36:43 +0200
Committer
 Syndamia <kamen@syndamia.com>
2024-12-31 15:36:43 +0200
Files7312c0751bf993d169413f488f201d13c407f87a /single.awk
csg-622d898e1637d01e14c2e92b913214857c00f901.tar
csg-622d898e1637d01e14c2e92b913214857c00f901.tar.gz
csg-622d898e1637d01e14c2e92b913214857c00f901.zip
Parenta37918bea9ffae7ee8ede84eb4ce6deb5709b631 (diff)
feat(single): Implement horizontal rules
1 files changed, 7 insertions, 1 deletions
-rw-r--r--single.awk8
diff --git a/single.awk b/single.awk
index 47cb391..726f519 100644
--- a/single.awk
+++ b/single.awk
@@ -7,8 +7,8 @@
# [x] Headers (atx and setex)
# [x] Blockquotes
# [ ] Lists
-# [ ] Horizontal rules
# [x] Code blocks
+# [x] Horizontal rules
# [ ] Span elements
# [ ] Links
# [ ] Inline
@@ -144,6 +144,12 @@ inside_codeblock && ! /^[ \t]*$/ {
not_paragraph = 1
}
+# Horizontal rule
+/^(---+|- - -( -)*|\*\*\*+|\* \* \*( \*)*|___+|_ _ _( _)*)$/ {
+ $0 = "<hr/>"
+ not_paragraph = 1
+}
+
# Paragraph
emptyP1 && !empty0 && !not_paragraph { $0 = "<p>" $0 }
!emptyP1 && empty0 && !not_paragraph_p1 { P1 = P1 "</p>" }