File tree Expand file tree Collapse file tree 4 files changed +36
-6
lines changed Expand file tree Collapse file tree 4 files changed +36
-6
lines changed Original file line number Diff line number Diff line change @@ -19436,7 +19436,9 @@ function linkify_headings() {
19436
19436
prev_section[prev_section.length - 1].sections || []
19437
19437
);
19438
19438
} else if (node.depth < data.prev_level) {
19439
- data.section_stack.pop();
19439
+ for (let i = 0; i < data.prev_level - node.depth; i++) {
19440
+ data.section_stack.pop();
19441
+ }
19440
19442
}
19441
19443
19442
19444
data.section_stack[data.section_stack.length - 1].push({
Original file line number Diff line number Diff line change @@ -18199,7 +18199,9 @@ function linkify_headings() {
18199
18199
prev_section[prev_section.length - 1].sections || []
18200
18200
);
18201
18201
} else if (node.depth < data.prev_level) {
18202
- data.section_stack.pop();
18202
+ for (let i = 0; i < data.prev_level - node.depth; i++) {
18203
+ data.section_stack.pop();
18204
+ }
18203
18205
}
18204
18206
18205
18207
data.section_stack[data.section_stack.length - 1].push({
Original file line number Diff line number Diff line change @@ -221,7 +221,9 @@ _headings(
221
221
222
222
#### one
223
223
224
- #### two
224
+ ##### two
225
+
226
+ ### style
225
227
` ,
226
228
data : {
227
229
dir : "docs" ,
@@ -242,8 +244,31 @@ _headings(
242
244
output . contents ,
243
245
`<h3><span id="component-format-script" class="offset-anchor"></span><a href="docs#component-format-script" class="anchor" aria-hidden></a>script</h3>
244
246
<h4><span id="component-format-script-one" class="offset-anchor"></span><a href="docs#component-format-script-one" class="anchor" aria-hidden></a>one</h4>
245
- <h4><span id="component-format-script-two" class="offset-anchor"></span><a href="docs#component-format-script-two" class="anchor" aria-hidden></a>two</h4>`
247
+ <h5><span id="component-format-script-one-two" class="offset-anchor" data-scrollignore></span><a href="docs#component-format-script-one-two" class="anchor" aria-hidden></a>two</h5>
248
+ <h3><span id="component-format-style" class="offset-anchor"></span><a href="docs#component-format-style" class="anchor" aria-hidden></a>style</h3>`
246
249
) ;
250
+
251
+ //@ts -ignore
252
+ assert . equal ( output . data . sections , [
253
+ {
254
+ slug : "component-format-script" ,
255
+ title : "script" ,
256
+ sections : [
257
+ {
258
+ slug : "component-format-script-one" ,
259
+ title : "one" ,
260
+ sections : [
261
+ {
262
+ slug : "component-format-script-one-two" ,
263
+ title : "two" ,
264
+ sections : [ ] ,
265
+ } ,
266
+ ] ,
267
+ } ,
268
+ ] ,
269
+ } ,
270
+ { slug : "component-format-style" , title : "style" , sections : [ ] } ,
271
+ ] ) ;
247
272
}
248
273
) ;
249
274
Original file line number Diff line number Diff line change @@ -97,7 +97,6 @@ export function linkify_headings(): Transformer {
97
97
}
98
98
99
99
data . slugs . push ( slug ) ;
100
- console . log ( data . slugs ) ;
101
100
102
101
// We keep a 'section_stack' to keep track of the section structure
103
102
if ( node . depth > data . prev_level ) {
@@ -108,7 +107,9 @@ export function linkify_headings(): Transformer {
108
107
prev_section [ prev_section . length - 1 ] . sections || [ ]
109
108
) ;
110
109
} else if ( node . depth < data . prev_level ) {
111
- data . section_stack . pop ( ) ;
110
+ for ( let i = 0 ; i < data . prev_level - node . depth ; i ++ ) {
111
+ data . section_stack . pop ( ) ;
112
+ }
112
113
}
113
114
114
115
data . section_stack [ data . section_stack . length - 1 ] . push ( {
You can’t perform that action at this time.
0 commit comments