File tree Expand file tree Collapse file tree 5 files changed +157
-7
lines changed Expand file tree Collapse file tree 5 files changed +157
-7
lines changed Original file line number Diff line number Diff line change @@ -47,10 +47,10 @@ export const convertToNodes = combineNodeParsers(
47
47
CommandLineNodeParser ,
48
48
FormulaNodeParser ,
49
49
BlankNodeParser ,
50
+ DecorationNodeParser ,
50
51
StrongImageNodeParser ,
51
52
StrongIconNodeParser ,
52
53
StrongNodeParser ,
53
- DecorationNodeParser ,
54
54
ImageNodeParser ,
55
55
ExternalLinkNodeParser ,
56
56
IconNodeParser ,
Original file line number Diff line number Diff line change @@ -58,17 +58,22 @@ Array [
58
58
" indent" : 0 ,
59
59
" nodes" : Array [
60
60
Object {
61
- " text" : " [! " ,
62
- " type" : " plain" ,
63
- },
64
- Object {
61
+ " decos" : Array [
62
+ " !" ,
63
+ ],
65
64
" nodes" : Array [
66
65
Object {
67
- " text" : " [[[[a " ,
66
+ " text" : " [[[[[ " ,
68
67
" type" : " plain" ,
69
68
},
69
+ Object {
70
+ " content" : " " ,
71
+ " href" : " a" ,
72
+ " pathType" : " relative" ,
73
+ " type" : " link" ,
74
+ },
70
75
],
71
- " type" : " strong " ,
76
+ " type" : " decoration " ,
72
77
},
73
78
],
74
79
" type" : " line" ,
@@ -99,6 +104,104 @@ Array [
99
104
]
100
105
` ;
101
106
107
+ exports [` decoration Decoration with strong icon notation (it's just icon, not strong): toMatchSnapshotWhenParsing 1` ] = `
108
+ Array [
109
+ Object {
110
+ " indent" : 0 ,
111
+ " nodes" : Array [
112
+ Object {
113
+ " decos" : Array [
114
+ " *-1" ,
115
+ ],
116
+ " nodes" : Array [
117
+ Object {
118
+ " text" : " [" ,
119
+ " type" : " plain" ,
120
+ },
121
+ Object {
122
+ " content" : " " ,
123
+ " href" : " progfay.icon" ,
124
+ " pathType" : " relative" ,
125
+ " type" : " link" ,
126
+ },
127
+ ],
128
+ " type" : " decoration" ,
129
+ },
130
+ Object {
131
+ " text" : " ]" ,
132
+ " type" : " plain" ,
133
+ },
134
+ ],
135
+ " type" : " line" ,
136
+ } ,
137
+ ]
138
+ ` ;
139
+
140
+ exports [` decoration Decoration with strong image notation (it's just image, not strong): toMatchSnapshotWhenParsing 1` ] = `
141
+ Array [
142
+ Object {
143
+ " indent" : 0 ,
144
+ " nodes" : Array [
145
+ Object {
146
+ " decos" : Array [
147
+ " *-1" ,
148
+ ],
149
+ " nodes" : Array [
150
+ Object {
151
+ " text" : " [" ,
152
+ " type" : " plain" ,
153
+ },
154
+ Object {
155
+ " link" : " " ,
156
+ " src" : " https://example.com/image.png" ,
157
+ " type" : " image" ,
158
+ },
159
+ ],
160
+ " type" : " decoration" ,
161
+ },
162
+ Object {
163
+ " text" : " ]" ,
164
+ " type" : " plain" ,
165
+ },
166
+ ],
167
+ " type" : " line" ,
168
+ } ,
169
+ ]
170
+ ` ;
171
+
172
+ exports [` decoration Decoration with strong notation (it's just link): toMatchSnapshotWhenParsing 1` ] = `
173
+ Array [
174
+ Object {
175
+ " indent" : 0 ,
176
+ " nodes" : Array [
177
+ Object {
178
+ " decos" : Array [
179
+ " *-1" ,
180
+ ],
181
+ " nodes" : Array [
182
+ Object {
183
+ " text" : " [" ,
184
+ " type" : " plain" ,
185
+ },
186
+ Object {
187
+ " content" : " " ,
188
+ " href" : " link" ,
189
+ " pathType" : " relative" ,
190
+ " type" : " link" ,
191
+ },
192
+ ],
193
+ " type" : " decoration" ,
194
+ },
195
+ Object {
196
+ " text" : " ]" ,
197
+ " type" : " plain" ,
198
+ },
199
+ ],
200
+ " type" : " line" ,
201
+ } ,
202
+ ]
203
+ ` ;
204
+
102
205
exports [` decoration Simple decoration: toMatchSnapshotWhenParsing 1` ] = `
103
206
Array [
104
207
Object {
Original file line number Diff line number Diff line change @@ -15,6 +15,37 @@ Array [
15
15
]
16
16
` ;
17
17
18
+ exports [` strong Decoration in Strong notation: toMatchSnapshotWhenParsing 1` ] = `
19
+ Array [
20
+ Object {
21
+ " indent" : 0 ,
22
+ " nodes" : Array [
23
+ Object {
24
+ " text" : " [[" ,
25
+ " type" : " plain" ,
26
+ },
27
+ Object {
28
+ " decos" : Array [
29
+ " !" ,
30
+ ],
31
+ " nodes" : Array [
32
+ Object {
33
+ " text" : " deco" ,
34
+ " type" : " plain" ,
35
+ },
36
+ ],
37
+ " type" : " decoration" ,
38
+ },
39
+ Object {
40
+ " text" : " ]]" ,
41
+ " type" : " plain" ,
42
+ },
43
+ ],
44
+ " type" : " line" ,
45
+ } ,
46
+ ]
47
+ ` ;
48
+
18
49
exports [` strong Simple strong: toMatchSnapshotWhenParsing 1` ] = `
19
50
Array [
20
51
Object {
Original file line number Diff line number Diff line change @@ -81,4 +81,16 @@ describe('decoration', () => {
81
81
it ( 'Decoration with many [ and link' , ( ) => {
82
82
expect ( '[! [[[[[[a]]' ) . toMatchSnapshotWhenParsing ( { hasTitle : false } )
83
83
} )
84
+
85
+ it ( "Decoration with strong notation (it's just link)" , ( ) => {
86
+ expect ( '[* [[link]]]' ) . toMatchSnapshotWhenParsing ( { hasTitle : false } )
87
+ } )
88
+
89
+ it ( "Decoration with strong icon notation (it's just icon, not strong)" , ( ) => {
90
+ expect ( '[* [[progfay.icon]]]' ) . toMatchSnapshotWhenParsing ( { hasTitle : false } )
91
+ } )
92
+
93
+ it ( "Decoration with strong image notation (it's just image, not strong)" , ( ) => {
94
+ expect ( '[* [[https://example.com/image.png]]]' ) . toMatchSnapshotWhenParsing ( { hasTitle : false } )
95
+ } )
84
96
} )
Original file line number Diff line number Diff line change @@ -6,4 +6,8 @@ describe('strong', () => {
6
6
it ( '[[]] is not strong' , ( ) => {
7
7
expect ( '[[]]' ) . toMatchSnapshotWhenParsing ( { hasTitle : false } )
8
8
} )
9
+
10
+ it ( 'Decoration in Strong notation' , ( ) => {
11
+ expect ( '[[[! deco]]]' ) . toMatchSnapshotWhenParsing ( { hasTitle : false } )
12
+ } )
9
13
} )
You can’t perform that action at this time.
0 commit comments