@@ -46,7 +46,7 @@ const validHeadings = [
4646 // 3. Variations on spacing
4747 "# Heading with extra space" ,
4848
49- // 4. Standalone hash (not a heading)
49+ // 4. Standalone hash
5050 "#" ,
5151
5252 // 5. Alternative heading styles (not covered by this rule)
@@ -107,32 +107,80 @@ const invalidTests = [
107107 {
108108 code : "#Heading 1" ,
109109 output : "# Heading 1" ,
110- errors : [ { messageId : "missingSpace" , column : 1 } ] ,
110+ errors : [
111+ {
112+ messageId : "missingSpace" ,
113+ column : 1 ,
114+ line : 1 ,
115+ endLine : 1 ,
116+ endColumn : 10 ,
117+ } ,
118+ ] ,
111119 } ,
112120 {
113121 code : "##Heading 2" ,
114122 output : "## Heading 2" ,
115- errors : [ { messageId : "missingSpace" , column : 2 } ] ,
123+ errors : [
124+ {
125+ messageId : "missingSpace" ,
126+ column : 2 ,
127+ line : 1 ,
128+ endLine : 1 ,
129+ endColumn : 11 ,
130+ } ,
131+ ] ,
116132 } ,
117133 {
118134 code : "###Heading 3" ,
119135 output : "### Heading 3" ,
120- errors : [ { messageId : "missingSpace" , column : 3 } ] ,
136+ errors : [
137+ {
138+ messageId : "missingSpace" ,
139+ column : 3 ,
140+ line : 1 ,
141+ endLine : 1 ,
142+ endColumn : 12 ,
143+ } ,
144+ ] ,
121145 } ,
122146 {
123147 code : "####Heading 4" ,
124148 output : "#### Heading 4" ,
125- errors : [ { messageId : "missingSpace" , column : 4 } ] ,
149+ errors : [
150+ {
151+ messageId : "missingSpace" ,
152+ column : 4 ,
153+ line : 1 ,
154+ endLine : 1 ,
155+ endColumn : 13 ,
156+ } ,
157+ ] ,
126158 } ,
127159 {
128160 code : "#####Heading 5" ,
129161 output : "##### Heading 5" ,
130- errors : [ { messageId : "missingSpace" , column : 5 } ] ,
162+ errors : [
163+ {
164+ messageId : "missingSpace" ,
165+ column : 5 ,
166+ line : 1 ,
167+ endLine : 1 ,
168+ endColumn : 14 ,
169+ } ,
170+ ] ,
131171 } ,
132172 {
133173 code : "######Heading 6" ,
134174 output : "###### Heading 6" ,
135- errors : [ { messageId : "missingSpace" , column : 6 } ] ,
175+ errors : [
176+ {
177+ messageId : "missingSpace" ,
178+ column : 6 ,
179+ line : 1 ,
180+ endLine : 1 ,
181+ endColumn : 15 ,
182+ } ,
183+ ] ,
136184 } ,
137185
138186 // 2. Mixed valid and invalid headings in one document
@@ -152,6 +200,8 @@ const invalidTests = [
152200 messageId : "missingSpace" ,
153201 line : 3 ,
154202 column : 2 ,
203+ endLine : 3 ,
204+ endColumn : 11 ,
155205 } ,
156206 ] ,
157207 } ,
@@ -160,38 +210,86 @@ const invalidTests = [
160210 {
161211 code : "#Text" ,
162212 output : "# Text" ,
163- errors : [ { messageId : "missingSpace" , column : 1 } ] ,
213+ errors : [
214+ {
215+ messageId : "missingSpace" ,
216+ column : 1 ,
217+ line : 1 ,
218+ endLine : 1 ,
219+ endColumn : 5 ,
220+ } ,
221+ ] ,
164222 } ,
165223 {
166224 code : "#Heading with trailing space " ,
167225 output : "# Heading with trailing space " ,
168- errors : [ { messageId : "missingSpace" , column : 1 } ] ,
226+ errors : [
227+ {
228+ messageId : "missingSpace" ,
229+ column : 1 ,
230+ line : 1 ,
231+ endLine : 1 ,
232+ endColumn : 28 ,
233+ } ,
234+ ] ,
169235 } ,
170236
171237 // 4. Headings containing code-like syntax
172238 // 4.1 With fenced code markers
173239 {
174240 code : "#Something with ``` backticks" ,
175241 output : "# Something with ``` backticks" ,
176- errors : [ { messageId : "missingSpace" , column : 1 } ] ,
242+ errors : [
243+ {
244+ messageId : "missingSpace" ,
245+ column : 1 ,
246+ line : 1 ,
247+ endLine : 1 ,
248+ endColumn : 29 ,
249+ } ,
250+ ] ,
177251 } ,
178252 // 4.2 With backticks mid-heading
179253 {
180254 code : "#Heading with ``` in the middle and more text after" ,
181255 output : "# Heading with ``` in the middle and more text after" ,
182- errors : [ { messageId : "missingSpace" , column : 1 } ] ,
256+ errors : [
257+ {
258+ messageId : "missingSpace" ,
259+ column : 1 ,
260+ line : 1 ,
261+ endLine : 1 ,
262+ endColumn : 51 ,
263+ } ,
264+ ] ,
183265 } ,
184266 // 4.3 With inline code
185267 {
186268 code : "#Heading with `inline code`" ,
187269 output : "# Heading with `inline code`" ,
188- errors : [ { messageId : "missingSpace" , column : 1 } ] ,
270+ errors : [
271+ {
272+ messageId : "missingSpace" ,
273+ column : 1 ,
274+ line : 1 ,
275+ endLine : 1 ,
276+ endColumn : 14 ,
277+ } ,
278+ ] ,
189279 } ,
190280 // 4.4 With tilde markers
191281 {
192282 code : "#Title with ~~~ tildes in it" ,
193283 output : "# Title with ~~~ tildes in it" ,
194- errors : [ { messageId : "missingSpace" , column : 1 } ] ,
284+ errors : [
285+ {
286+ messageId : "missingSpace" ,
287+ column : 1 ,
288+ line : 1 ,
289+ endLine : 1 ,
290+ endColumn : 28 ,
291+ } ,
292+ ] ,
195293 } ,
196294
197295 // 5. Multi-line documents
@@ -203,7 +301,15 @@ Text after`,
203301 output : dedent `Text before
204302# Heading with \`\`\` code markers
205303Text after` ,
206- errors : [ { messageId : "missingSpace" , line : 2 , column : 1 } ] ,
304+ errors : [
305+ {
306+ messageId : "missingSpace" ,
307+ line : 2 ,
308+ column : 1 ,
309+ endLine : 2 ,
310+ endColumn : 30 ,
311+ } ,
312+ ] ,
207313 } ,
208314 // 5.2 Multiple incorrect headings in one file
209315 {
@@ -222,9 +328,27 @@ Text after`,
222328
223329 ### Third heading` ,
224330 errors : [
225- { messageId : "missingSpace" , line : 1 , column : 1 } ,
226- { messageId : "missingSpace" , line : 5 , column : 2 } ,
227- { messageId : "missingSpace" , line : 7 , column : 3 } ,
331+ {
332+ messageId : "missingSpace" ,
333+ line : 1 ,
334+ column : 1 ,
335+ endLine : 1 ,
336+ endColumn : 14 ,
337+ } ,
338+ {
339+ messageId : "missingSpace" ,
340+ line : 5 ,
341+ column : 2 ,
342+ endLine : 5 ,
343+ endColumn : 16 ,
344+ } ,
345+ {
346+ messageId : "missingSpace" ,
347+ line : 7 ,
348+ column : 3 ,
349+ endLine : 7 ,
350+ endColumn : 16 ,
351+ } ,
228352 ] ,
229353 } ,
230354
@@ -239,7 +363,15 @@ Text after`,
239363
240364 # Not a heading in indented code block
241365 console.log("#still in code block");` ,
242- errors : [ { messageId : "missingSpace" , line : 3 , column : 1 } ] ,
366+ errors : [
367+ {
368+ messageId : "missingSpace" ,
369+ line : 3 ,
370+ column : 1 ,
371+ endLine : 3 ,
372+ endColumn : 37 ,
373+ } ,
374+ ] ,
243375 } ,
244376] ;
245377
0 commit comments