aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--def.peg24
1 files changed, 18 insertions, 6 deletions
diff --git a/def.peg b/def.peg
index 336a446..576f884 100644
--- a/def.peg
+++ b/def.peg
@@ -8,15 +8,23 @@
Markdown <- MetaBlock* Block*
# Block elements
-Block <- Header / List / LinkDefinition / Paragraph
+Block <- Header
+ / List
+ / LinkDefinition
+ / Paragraph
Header <- '#'+ SPACE* !NEWLINE Words? SPACE* NEWLINE
List <- ([-*]+ / [[:digit:]]+ [).]) (_ (List / Words))? NEWLINE
LinkDefinition <- LinkLabel ':' _? Uri (_ LinkTitle)? NEWLINE
Paragraph <- Words (HardBreak Words)* NEWLINE+
# Inline elements
-Words <- StyledWords / LinkedWords / AnnotatedWords / PlainWords
-StyledWords <- '*' Words '*' / '**' Words '**' / '_' Words '_'
+Words <- StyledWords
+ / LinkedWords
+ / AnnotatedWords
+ / PlainWords
+StyledWords <- '*' Words '*'
+ / '**' Words '**'
+ / '_' Words '_'
LinkedWords <- '[' Words ']' '(' ((Uri _)? LinkTitle / Uri) ')'
/ '[' Words ']' LinkLabel
/ LinkLabel
@@ -26,11 +34,15 @@ LinkTitle <- '"' _? !'"' _? PlainWords _? '"'
/ "'" _? !"'" PlainWords _? "'"
/ "(" _? ![()] PlainWords _? ")"
PlainWords <- PRINTABLES (_ PRINTABLES)*
-Uri <- '<' ![<>] PRINTABLES? '>' / ![<>] PRINTABLES
+Uri <- '<' ![<>] PRINTABLES? '>'
+ / ![<>] PRINTABLES
HardBreak <- SPACE SPACE+ NEWLINE
-_ <- SPACE+ / SPACE? NEWLINE SPACE? SPACE? SPACE?
+_ <- SPACE+
+ / SPACE? NEWLINE SPACE? SPACE? SPACE?
# Terminals
PRINTABLES <- [[:graph:]]+
SPACE <- ' '
-NEWLINE <- '\r\n' / '\n' / '\r'
+NEWLINE <- '\r\n'
+ / '\n'
+ / '\r'