aboutsummaryrefslogtreecommitdiff
path: root/code/grammar/markdown.pest
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2022-09-26 15:16:05 +0200
committermetamuffin <metamuffin@disroot.org>2022-09-26 15:16:05 +0200
commita5ee9b1edd25f698813ebdc52404ec19fa479718 (patch)
tree7d428ca9b2b0059e39f78bc096bf57b94f1d8a3d /code/grammar/markdown.pest
parent15d78464ba9a717a71e1dc47a4101c8b13ec6581 (diff)
downloadmetamuffin-blog-a5ee9b1edd25f698813ebdc52404ec19fa479718.tar
metamuffin-blog-a5ee9b1edd25f698813ebdc52404ec19fa479718.tar.bz2
metamuffin-blog-a5ee9b1edd25f698813ebdc52404ec19fa479718.tar.zst
new renderer
Diffstat (limited to 'code/grammar/markdown.pest')
-rw-r--r--code/grammar/markdown.pest20
1 files changed, 14 insertions, 6 deletions
diff --git a/code/grammar/markdown.pest b/code/grammar/markdown.pest
index 43c6e7a..ebdfcd7 100644
--- a/code/grammar/markdown.pest
+++ b/code/grammar/markdown.pest
@@ -1,9 +1,17 @@
-file = _{SOI ~ block* ~ EOI}
-block = { (header | list | span | "") ~ NEWLINE }
-header = {"#"+ ~ span}
-list = { list_item+ }
-list_item = { "-" ~ span }
-span = { (!NEWLINE ~ ANY)+ }
+file = _{ SOI ~ block* ~ EOI }
+
+block = { (code_block | header | list | paragraph | "") ~ NEWLINE }
+ header = { "#"+ ~ span }
+ list = { list_item+ }
+ list_item = { "-" ~ span }
+ paragraph = { span }
+ code_block = { "```" ~ (!"```" ~ ANY) ~ "```" }
+
+span = { (style_bold | style_italic | style_code | text)+ }
+ style_bold = { "**" ~ text ~ "**" }
+ style_italic = { "_" ~ text ~ "_" }
+ style_code = { "`" ~ text ~ "`" }
+ text = { (!(NEWLINE | "*" | "_" | "`") ~ ANY)+ }