-
Notifications
You must be signed in to change notification settings - Fork 2
/
attached-modifier-edge-cases.norg
67 lines (45 loc) · 1.64 KB
/
attached-modifier-edge-cases.norg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
* Attached Modifier Edge Cases and How to Handle Them
Attached modifiers are a difficult construct to parse even by modern standards.
While Norg would love to substitute them for a less ambiguous syntax, attached modifiers
are so engrained in our expectations for markup today that they are simply impossible to replace.
** Attached Modifier Conflicts
We define an "opening/closing conflict" as an opening/closing attached modifier that does not have
a respective counterpart. Complicated cases arise when unclosed markup meets closed markup, forcing
parsers to be very vigilent at all times despite the strict rules imposed by the Norg specification.
* Conflicts vs. Closed Markup
Left-flanking, internal:
|example
*/hello*
|end
Left-flanking, external:
|example
/*hello*
|end
Right-flanking, internal:
|example
*hello/*
|end
Right-flanking, external - this particular case is especially tricky as the `/` could accidentally
be considered an opening modifier by an unsuspecting parser.
|example
*hello*/ world
|end
* Consecutive
Duplex, dissimilar:
|example
*hello*/world/
|end
Duplex, similar - note that as per the specification consecutive attached modifiers should be
ignored and treated as raw text, therefore the below example becomes a single, monolithic `bold`:
|example
*hello**world*
|end
* Nested
Multiplex, intertwined with duplication - a very daunting edge case, where the inner `*` cannot be
disambiguated with a `GLR(1)` and the same character is surrounding the `*`. Do not mistake it for italic!:
|example
*/hello/*/world/
|end
===
#comment
vim: conceallevel=0