File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed
tests/Elastic.Markdown.Tests/Inline Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change @@ -162,8 +162,8 @@ private void ReadDocumentInstructions(MarkdownDocument document)
162162 }
163163
164164 var contents = document
165- . Where ( block => block is HeadingBlock { Level : >= 2 } )
166- . Cast < HeadingBlock > ( )
165+ . Descendants < HeadingBlock > ( )
166+ . Where ( block => block is { Level : >= 2 } )
167167 . Select ( h => ( h . GetData ( "header" ) as string , h . GetData ( "anchor" ) as string ) )
168168 . Select ( h => new PageTocItem
169169 {
Original file line number Diff line number Diff line change @@ -34,6 +34,13 @@ protected override void AddToFileSystem(MockFileSystem fileSystem)
3434
3535## New Requirements [#new-reqs]
3636
37+
38+ :::{dropdown} Nested heading
39+
40+ ##### Heading inside dropdown [#heading-inside-dropdown]
41+
42+ :::
43+
3744These are new requirements
3845""" ;
3946 fileSystem . AddFile ( @"docs/testing/req.md" , inclusion ) ;
@@ -147,3 +154,21 @@ public void GeneratesHtml() =>
147154 public void HasError ( ) => Collector . Diagnostics . Should ( ) . HaveCount ( 1 )
148155 . And . Contain ( d => d . Message . Contains ( "`sub-requirements2` does not exist" ) ) ;
149156}
157+
158+
159+ public class NestedHeadingTest ( ITestOutputHelper output ) : AnchorLinkTestBase ( output ,
160+ """
161+ [Heading inside dropdown](testing/req.md#heading-inside-dropdown)
162+ """
163+ )
164+ {
165+ [ Fact ]
166+ public void GeneratesHtml ( ) =>
167+ // language=html
168+ Html . Should ( ) . Contain (
169+ """<a href="testing/req.html#heading-inside-dropdown">Heading inside dropdown</a>"""
170+ ) ;
171+
172+ [ Fact ]
173+ public void HasError ( ) => Collector . Diagnostics . Should ( ) . HaveCount ( 0 ) ;
174+ }
You can’t perform that action at this time.
0 commit comments