aboutsummaryrefslogtreecommitdiff
path: root/def.peg
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-05-18 09:57:49 +0200
committerJonas Smedegaard <dr@jones.dk>2025-05-18 14:04:19 +0200
commit72827171201ee9c022a6a8c30107e55a16c3826c (patch)
tree8c65ca47565cf6deda0a39b8dfafe93f01a23a3e /def.peg
parentd12d53a62ec7f0d1cf71eba54dbdc7925c922104 (diff)
define LinkLabel
Diffstat (limited to 'def.peg')
-rw-r--r--def.peg7
1 files changed, 4 insertions, 3 deletions
diff --git a/def.peg b/def.peg
index 4fb3295..4e64c27 100644
--- a/def.peg
+++ b/def.peg
@@ -12,7 +12,7 @@ Block <- Header / List / LinkDefinition / Paragraph
Header <- '#'+ SPACE* Words? SPACE* NEWLINE
List <- ([-*]+ / [[:digit:]]+ [).]) (SPACE+ (List / Words))?
NEWLINE
-LinkDefinition <- '[' !'[]' PlainWords ']' ':' SPACE Uri NEWLINE
+LinkDefinition <- LinkLabel ':' SPACE Uri NEWLINE
SPACE SPACE '"' !'"' PlainWords '"' NEWLINE
Paragraph <- (Words (SPACE? NEWLINE / HardBreak))+
NEWLINE+
@@ -21,9 +21,10 @@ Paragraph <- (Words (SPACE? NEWLINE / HardBreak))+
Words <- StyledWords / LinkedWords / AnnotatedWords / PlainWords
StyledWords <- '*' Words '*' / '**' Words '**' / '_' Words '_'
LinkedWords <- '[' Words ']' '(' Uri ')'
- / '[' Words ']' '[' ![\[\]] LinkDefinitionKeyphrase ']'
- / '[' LinkDefinitionKeyphrase ']'
+ / '[' Words ']' LinkLabel
+ / LinkLabel
AnnotatedWords <- '[' Words ']' '{' ![{}] PlainWords '}'
+LinkLabel <- '[' SPACE? ![\[\]] PlainWords SPACE? ']'
PlainWords <- PRINTABLES (SPACE PRINTABLES)*
Uri <- '<' ![<>] PRINTABLES? '>' / ![<>] PRINTABLES
HardBreak <- SPACE SPACE+ NEWLINE