nuxt / content

The file-based CMS for your Nuxt application, powered by Markdown and Vue components.
https://content.nuxt.com
MIT License
3.13k stars 627 forks source link

Add option to preserve original heading markup in TOC sidebar #2842

Open septatrix opened 4 days ago

septatrix commented 4 days ago

Is your feature request related to a problem? Please describe

Sometimes on uses markup in headers like code sections or emph/bold...or where this is most apparent: strikethrough (~foo~). Another think which often gets added to headers are badges/pill. Most of the time it would make sense to also show them in the TOC.

If these are displayed in the sidebar without their markup they can unexpectedly look different, have a completely different meaning (if strikethrough is omitted), or are just harder to spot (badges).

Describe the solution you'd like

It should be possible to preserve show the entries in the TOC in the same way they are in the original headers, just with a smaller font size.

Describe alternatives you've considered

Not using markup in headings any more or living with the style getting lost. For emph, bold, and code styling this is somewhat acceptable as they text without styling is semantically the same. Losing strikethrough, however, would lead to a different meaning. The only option is to stop using it but this restricts how one can author their content. Additionally, for stuff like badges there is no satisfactory workaround.