Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected function isHeadingWithinBounds(array $heading): bool
protected function createTableItem(array $heading): array
{
return [
'title' => $heading['title'],
'title' => (new ConvertsMarkdownToPlainText($heading['title']))->execute(),
'identifier' => $heading['identifier'],
'children' => [],
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,19 @@ public function testNonHeadingMarkdownIsIgnored()
);
}

public function testMarkdownIsStrippedFromHeadingTitles()
{
$markdown = '## To learn more, head over to the [Quickstart page](quickstart).';

$this->assertSame([
[
'title' => 'To learn more, head over to the Quickstart page.',
'identifier' => 'to-learn-more-head-over-to-the-quickstart-pagequickstart',
'children' => [],
],
], (new GeneratesTableOfContents($markdown))->execute());
}

public function testWithNoLevelOneHeading()
{
$markdown = <<<'MARKDOWN'
Expand Down
Loading