Only create ToC for headings with links
What does this MR do and why?
Only create ToC for headings with links
If a heading in a file exists without a link inside it, creating items for the table of contents will through an error. A filter on headers ensures that only those elements that do have an ancore tag are added to the array. Affecting rich viewer render of AsciiDoc, reStructuredText.
Changelog: fixed
References
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
dropdown not even rendered |
![]() |
How to set up and validate locally
- Go to a Project/Repository
- Click plus sign in the header and choose New file
- Create an example AsciiDoc file
- Go to a file and make sure that a dropdown for table of contents renders correctly.
Example file:
// Test.adoc
= Test Code
Jane Smith <jane@example.com>
:description: test article
:doctype: article
:revdate: 12025-08-19
:doctype: article
:hardbreaks-option:
// ================================================================================
== title 1
// ================================================================================
* here is some content
// ================================================================================
== title 2
// ================================================================================
* first list item
* second list item
** with nested item
// ================================================================================
== title 3
// ================================================================================
* some extra text
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #539276 (closed)
Edited by Paulina Sedlak-Jakubowska


