@@ -437,6 +437,73 @@ suite("TOC.", () => {
437437 await resetConfiguration ( ) ;
438438 } ) ;
439439
440+ test ( "Exclude omitted headings (`toc.omittedFromToc`)" , async ( ) => {
441+ await updateConfiguration ( {
442+ config : [ [ "markdown.extension.toc.omittedFromToc" , {
443+ '*.md' : [ '# Head 1' ] ,
444+ 'not-ignored.md' : [ '# Head 1' ]
445+ } ] ]
446+ } ) ;
447+ await testCommand (
448+ 'markdown.extension.toc.create' ,
449+ [
450+ '' ,
451+ '' ,
452+ '# Introduction' ,
453+ '## Sub heading (should be ignored, too)' ,
454+ '# Head 1' ,
455+ '' ,
456+ // Underlined heading should be ignored, too.
457+ 'Underlined heading' ,
458+ '------------------' ,
459+ '' ,
460+ '- [Head 1](#head-1)' ,
461+ '- [Head 2](#head-2)' ,
462+ '- [Head 3](#head-3)' ,
463+ '' ,
464+ '- [Head 1](#head-1)' ,
465+ '- [Head 2](#head-2)' ,
466+ '- [Head 3](#head-3)' ,
467+ '' ,
468+ '# Head 3' ,
469+ '## Ignored - with "special" ~ chars' ,
470+ // Second "Introduction" heading is visible (should have a number suffix in ToC).
471+ '## Introduction' ,
472+ '# Head 4'
473+ ] ,
474+ new Selection ( 0 , 0 , 0 , 0 ) ,
475+ [
476+ '- [Head 1](#head-1)' ,
477+ '- [Head 3](#head-3)' ,
478+ ' - [Introduction](#introduction-1)' ,
479+ '- [Head 4](#head-4)' ,
480+ '' ,
481+ '' ,
482+ '# Introduction' ,
483+ '## Sub heading (should be ignored, too)' ,
484+ '# Head 1' ,
485+ '' ,
486+ 'Underlined heading' ,
487+ '------------------' ,
488+ '' ,
489+ '- [Head 1](#head-1)' ,
490+ '- [Head 2](#head-2)' ,
491+ '- [Head 3](#head-3)' ,
492+ '' ,
493+ '- [Head 1](#head-1)' ,
494+ '- [Head 2](#head-2)' ,
495+ '- [Head 3](#head-3)' ,
496+ '' ,
497+ '# Head 3' ,
498+ '## Ignored - with "special" ~ chars' ,
499+ '## Introduction' ,
500+ '# Head 4'
501+ ] ,
502+ new Selection ( 4 , 0 , 4 , 0 )
503+ ) ;
504+ await resetConfiguration ( ) ;
505+ } ) ;
506+
440507 test ( "Inline <!-- omit from toc -->" , ( ) => {
441508 return testCommand ( 'markdown.extension.toc.create' ,
442509 [
0 commit comments