Data-theme-toc="true" should be placed at the top of a post in it's own paragraph

I just made this bug report and it seems as far as parsing the user input, the composer is up to spec.

The original issue arose when a user inserted the <div data-theme-toc="true"> </div> code to trigger the table of contents. As someone unfamiliar with the markdown spec, they had no idea that not having a blank line after this html code would cause a rendering issue.

I would propose two things. Using the composer interface (+) button to insert this code should

  1. insert the code at the top of the post
  2. put a blank line after the code

Of course the user could still botch it up, but it could prevent the issue we had.

It’s a great component by the way. Extremely useful!

1 Like

I agree this would be a nice QoL improvement, (moved it to Contribute > Feature though)

1 Like

I usually put the <div data-theme-toc="true"> </div> at the very last line of the post. Then there is nothing below which might look weird. Exploring TOC Issues