jupyterlab/jupyterlab-toc

Headers not always being picked up correctly

Opened this issue · 5 comments

Depending on the text before, sometimes a header is not picked up correctly. For example:

hello

# My H1

vs.

- hello

# My H1

image

*Edited because I misinterpreted what was happening

@mlucool I am a bit confused by your screenshot. What are we looking at? Is the left side the ToC and the right side a notebook?

In general, a heading should always be the first line in a Markdown cell. For the ToC to correctly register a heading, this is the convention that should be adhered to.

What are we looking at? Is the left side the ToC and the right side a notebook?

Yes

In general, a heading should always be the first line in a Markdown cell.

I agree with this. Maybe that should be enforced?

(As an FYI, the left has toggle code cells enabled)

In general, a heading should always be the first line in a Markdown cell.

This is a tragically unfortunate requirement. When making slides, it's often helpful and necessary to have multiple headings on a slide; multiple headings in a cell.

All headings should be included in the Table of Contents regardless of whether they're the first heading in the cell.

Could that be the new default behavior, or would there need to be a configuration setting?

@westurner Unfortunately, there is no simple implementation for making this possible. If there was an easy fix, I was not able to find it. Feel free to submit a PR if you are able to find a maintainable solution.