-s ::= Doc => top
-
-Doc ::= {Header} Body /ws => doc
-Header ::= "header" { kv */ ws } /ws => header
-Body ::= Section*/ws => body
-Section ::= { SectionHeader Paragraph* /ws => section }
-SectionHeader ::= "==" SectionHeaderBody "=="
-SectionHeaderBody ::= "=" SectionHeaderBody "="
- > ws text ws
-
-sp !::= " "**
-blank ::= sp "\n" sp "\n" ws
-
-kv ::= word "=" text /ws => kv1
-wp !::= w++
-num !::= [0-9]++
-Paragraph ::= { "\"\"" ws text } => "blockquote"
- > uli+/ws => "ul"
- > { "# " text } => "ol"
- > { num " " ws text } => "ol"
- > { "---" "-"* } => "hr"
- > { text } => "p"
-uli ::= { "* " text } => "li"
-
-text ::= Item => text
-Itemx ::= ws Item
+s = top:: Doc
+
+Doc = doc:: {Header} Body /ws
+Header = header:: "header" { kv */ ws } /ws
+Body = body:: Section*/ws
+Section = { section:: SectionHeader Paragraph* /ws }
+SectionHeader = "==" SectionHeaderBody "=="
+SectionHeaderBody = "=" SectionHeaderBody "="
+ > !ws text !ws
+
+sp = " "**
+blank = !sp "\n" !sp "\n" !ws
+
+kv = kv1:: word "=" text /ws
+wp = w++
+num = [0-9]++
+Paragraph = blockquote:: { "\"\"" !ws text }
+ > hr:: { "---" "-"* }
+ > p:: { text }
+
+onums = nums !(". "|") ")
+any = ~[]*
+
+uli = li:: "* " (!ws text &~ any (oli|uli))
+oli = li:: ("# "|onums) (!ws text &~ any (oli|uli))
+
+//
+
+text = text:: Item
+Itemx = !ws Item