File tree Expand file tree Collapse file tree 5 files changed +181
-10
lines changed Expand file tree Collapse file tree 5 files changed +181
-10
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 @@ -65,20 +65,26 @@ Array [
65
65
" indent" : 0 ,
66
66
" nodes" : Array [
67
67
Object {
68
- " raw" : " [! " ,
69
- " text" : " [! " ,
70
- " type" : " plain" ,
71
- },
72
- Object {
68
+ " decos" : Array [
69
+ " !" ,
70
+ ],
73
71
" nodes" : Array [
74
72
Object {
75
- " raw" : " [[[[a " ,
76
- " text" : " [[[[a " ,
73
+ " raw" : " [[[[[ " ,
74
+ " text" : " [[[[[ " ,
77
75
" type" : " plain" ,
78
76
},
77
+ Object {
78
+ " content" : " " ,
79
+ " href" : " a" ,
80
+ " pathType" : " relative" ,
81
+ " raw" : " [a]" ,
82
+ " type" : " link" ,
83
+ },
79
84
],
80
- " raw" : " [[[[[[a]]" ,
81
- " type" : " strong" ,
85
+ " raw" : " [! [[[[[[a]]" ,
86
+ " rawDecos" : " !" ,
87
+ " type" : " decoration" ,
82
88
},
83
89
],
84
90
" type" : " line" ,
@@ -112,6 +118,119 @@ Array [
112
118
]
113
119
` ;
114
120
121
+ exports [` decoration Decoration with strong icon notation (it's just icon, not strong): toMatchSnapshotWhenParsing 1` ] = `
122
+ Array [
123
+ Object {
124
+ " indent" : 0 ,
125
+ " nodes" : Array [
126
+ Object {
127
+ " decos" : Array [
128
+ " *-1" ,
129
+ ],
130
+ " nodes" : Array [
131
+ Object {
132
+ " raw" : " [" ,
133
+ " text" : " [" ,
134
+ " type" : " plain" ,
135
+ },
136
+ Object {
137
+ " content" : " " ,
138
+ " href" : " progfay.icon" ,
139
+ " pathType" : " relative" ,
140
+ " raw" : " [progfay.icon]" ,
141
+ " type" : " link" ,
142
+ },
143
+ ],
144
+ " raw" : " [* [[progfay.icon]]" ,
145
+ " rawDecos" : " *" ,
146
+ " type" : " decoration" ,
147
+ },
148
+ Object {
149
+ " raw" : " ]" ,
150
+ " text" : " ]" ,
151
+ " type" : " plain" ,
152
+ },
153
+ ],
154
+ " type" : " line" ,
155
+ } ,
156
+ ]
157
+ ` ;
158
+
159
+ exports [` decoration Decoration with strong image notation (it's just image, not strong): toMatchSnapshotWhenParsing 1` ] = `
160
+ Array [
161
+ Object {
162
+ " indent" : 0 ,
163
+ " nodes" : Array [
164
+ Object {
165
+ " decos" : Array [
166
+ " *-1" ,
167
+ ],
168
+ " nodes" : Array [
169
+ Object {
170
+ " raw" : " [" ,
171
+ " text" : " [" ,
172
+ " type" : " plain" ,
173
+ },
174
+ Object {
175
+ " link" : " " ,
176
+ " raw" : " [https://example.com/image.png]" ,
177
+ " src" : " https://example.com/image.png" ,
178
+ " type" : " image" ,
179
+ },
180
+ ],
181
+ " raw" : " [* [[https://example.com/image.png]]" ,
182
+ " rawDecos" : " *" ,
183
+ " type" : " decoration" ,
184
+ },
185
+ Object {
186
+ " raw" : " ]" ,
187
+ " text" : " ]" ,
188
+ " type" : " plain" ,
189
+ },
190
+ ],
191
+ " type" : " line" ,
192
+ } ,
193
+ ]
194
+ ` ;
195
+
196
+ exports [` decoration Decoration with strong notation (it's just link): toMatchSnapshotWhenParsing 1` ] = `
197
+ Array [
198
+ Object {
199
+ " indent" : 0 ,
200
+ " nodes" : Array [
201
+ Object {
202
+ " decos" : Array [
203
+ " *-1" ,
204
+ ],
205
+ " nodes" : Array [
206
+ Object {
207
+ " raw" : " [" ,
208
+ " text" : " [" ,
209
+ " type" : " plain" ,
210
+ },
211
+ Object {
212
+ " content" : " " ,
213
+ " href" : " link" ,
214
+ " pathType" : " relative" ,
215
+ " raw" : " [link]" ,
216
+ " type" : " link" ,
217
+ },
218
+ ],
219
+ " raw" : " [* [[link]]" ,
220
+ " rawDecos" : " *" ,
221
+ " type" : " decoration" ,
222
+ },
223
+ Object {
224
+ " raw" : " ]" ,
225
+ " text" : " ]" ,
226
+ " type" : " plain" ,
227
+ },
228
+ ],
229
+ " type" : " line" ,
230
+ } ,
231
+ ]
232
+ ` ;
233
+
115
234
exports [` decoration Simple decoration: toMatchSnapshotWhenParsing 1` ] = `
116
235
Array [
117
236
Object {
Original file line number Diff line number Diff line change @@ -16,6 +16,42 @@ Array [
16
16
]
17
17
` ;
18
18
19
+ exports [` strong Decoration in Strong notation: toMatchSnapshotWhenParsing 1` ] = `
20
+ Array [
21
+ Object {
22
+ " indent" : 0 ,
23
+ " nodes" : Array [
24
+ Object {
25
+ " raw" : " [[" ,
26
+ " text" : " [[" ,
27
+ " type" : " plain" ,
28
+ },
29
+ Object {
30
+ " decos" : Array [
31
+ " !" ,
32
+ ],
33
+ " nodes" : Array [
34
+ Object {
35
+ " raw" : " deco" ,
36
+ " text" : " deco" ,
37
+ " type" : " plain" ,
38
+ },
39
+ ],
40
+ " raw" : " [! deco]" ,
41
+ " rawDecos" : " !" ,
42
+ " type" : " decoration" ,
43
+ },
44
+ Object {
45
+ " raw" : " ]]" ,
46
+ " text" : " ]]" ,
47
+ " type" : " plain" ,
48
+ },
49
+ ],
50
+ " type" : " line" ,
51
+ } ,
52
+ ]
53
+ ` ;
54
+
19
55
exports [` strong Simple strong: toMatchSnapshotWhenParsing 1` ] = `
20
56
Array [
21
57
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