question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Right TOC does not include headings generated outside of markdown

See original GitHub issue

🐛 Bug Report

This is for v2. The right TOC for documentation pages does not include headings that were generated outside of the markdown syntax.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. Add a <h2 id="my-anchor">Title</h2> HTML tag anywhere in a documentation markdown file.
  2. Notice it does not show up in the right TOC.

Expected behavior

I expect for the title to show in in the right TOC just as it would if I provided a ## Title line.

Actual Behavior

The heading does not show up in the right TOC.

Reproducible Demo

n/a


My primary issue with this is adding heading in custom components. Even when I import Heading:

import Heading from '@theme/Heading';

let Title = Heading('h2');

return (<Title>My title</Title>);

While this includes the appropriate anchor links, it still does not show up in the right TOC.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
slorbercommented, Nov 16, 2020

Hi @jacksongoode

I’d like to enable better MDX composition patterns (ie mdx partials/fragments) without loosing that TOC feature like we currently do.

Unfortunately have to finish i18n support in v2 first, but it’s in my mind to work on this problem.

1reaction
jacksongoodecommented, Nov 16, 2020

Hi.

I wanted to bring this topic back up since there doesn’t currently appear to be a way to generate a TOC from an .mdx/.js - only through markdown. Is there a hacky way to achieve this through html alone?

I am rendering new pages with content in an mdx and it would be nice to have a TOC for them.

Read more comments on GitHub >

github_iconTop Results From Across the Web

4.18 Omit a heading in the table of contents - Bookdown
If you do not want certain section headings to be included in the table of contents, you can add two classes to the...
Read more >
How to add table of contents in Rmarkdown? - Stack Overflow
## Header 2 When you click the **Knit** button a document will be generated that includes both content as well as the output...
Read more >
Headings and Table of contents - Docusaurus
Markdown headings within hideable areas will still show up in the TOC. For example, headings within Tabs and details will not be excluded....
Read more >
Add a Generated Table of Contents Anywhere in RMarkdown
When I use toc: true in a post the toc is inserted at the very top of the post. … If you could...
Read more >
8.5 R markdown anatomy | An Introduction to R
In RStudio a minimal YAML header is automatically created for you when you ... your R markdown document outside a code chunk which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found