aboutsummaryrefslogtreecommitdiff
path: root/def.peg
diff options
context:
space:
mode:
Diffstat (limited to 'def.peg')
-rw-r--r--def.peg7
1 files changed, 5 insertions, 2 deletions
diff --git a/def.peg b/def.peg
index 8bec09d..336a446 100644
--- a/def.peg
+++ b/def.peg
@@ -11,17 +11,20 @@ Markdown <- MetaBlock* Block*
Block <- Header / List / LinkDefinition / Paragraph
Header <- '#'+ SPACE* !NEWLINE Words? SPACE* NEWLINE
List <- ([-*]+ / [[:digit:]]+ [).]) (_ (List / Words))? NEWLINE
-LinkDefinition <- LinkLabel ':' _? Uri (_ '"' !'"' PlainWords '"')? NEWLINE
+LinkDefinition <- LinkLabel ':' _? Uri (_ LinkTitle)? NEWLINE
Paragraph <- Words (HardBreak Words)* NEWLINE+
# Inline elements
Words <- StyledWords / LinkedWords / AnnotatedWords / PlainWords
StyledWords <- '*' Words '*' / '**' Words '**' / '_' Words '_'
-LinkedWords <- '[' Words ']' '(' Uri ')'
+LinkedWords <- '[' Words ']' '(' ((Uri _)? LinkTitle / Uri) ')'
/ '[' Words ']' LinkLabel
/ LinkLabel
AnnotatedWords <- '[' Words ']' '{' ![{}] PlainWords '}'
LinkLabel <- '[' _? ![\[\]] PlainWords _? ']'
+LinkTitle <- '"' _? !'"' _? PlainWords _? '"'
+ / "'" _? !"'" PlainWords _? "'"
+ / "(" _? ![()] PlainWords _? ")"
PlainWords <- PRINTABLES (_ PRINTABLES)*
Uri <- '<' ![<>] PRINTABLES? '>' / ![<>] PRINTABLES
HardBreak <- SPACE SPACE+ NEWLINE