aboutsummaryrefslogtreecommitdiff
path: root/code/grammar/markdown.pest
blob: ebdfcd799f50743bf4cb44ef03487c91450574d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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)+ }