File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -216,4 +216,25 @@ public function testTocMultipleSettings()
216216 $ actual = $ this ->parsedownExtended ->text ($ markdown );
217217 $ this ->assertEquals ($ expected , $ actual );
218218 }
219+
220+ /**
221+ * Test case to ensure that the ToC resets between different markdown parses.
222+ */
223+ public function testTocResetsBetweenParses ()
224+ {
225+ $ this ->parsedownExtended ->config ()->set ('headings.auto_anchors ' , true );
226+ $ this ->parsedownExtended ->config ()->set ('toc ' , true );
227+ $ this ->parsedownExtended ->config ()->set ('toc.tag ' , '[toc] ' );
228+
229+ $ markdown1 = "[toc] \n# First " ;
230+ $ markdown2 = "[toc] \n# Second " ;
231+
232+ $ this ->parsedownExtended ->text ($ markdown1 );
233+ $ firstToc = $ this ->parsedownExtended ->contentsList ();
234+
235+ $ this ->parsedownExtended ->text ($ markdown2 );
236+ $ secondToc = $ this ->parsedownExtended ->contentsList ();
237+
238+ $ this ->assertStringNotContainsString ('First ' , $ secondToc );
239+ $ this ->assertStringContainsString ('Second ' , $ secondToc );
219240}
You can’t perform that action at this time.
0 commit comments