DannyBen / madness

Instant Markdown Server
https://madness.dannyb.co
MIT License
135 stars 19 forks source link

ToC levels for not autogenerated ToC are not honored #178

Closed xorguy closed 7 months ago

xorguy commented 7 months ago

Hi.

I tend to use an automated table of contents using "Markdown All in One" for VSCode, because it allows me browsing the document from within the document.

The problem is that when it is served with madness the levels are not respected but using the automatic ToC generator from madness it creates the correct levels.

As an example I have as a manual ToC:

- [first level](#first-level)
  - [second level](#second-level)
    - [third level](#third-level)

But once is served by madness I only get:

· first level
    · second level
    · third level

So only two levels are shown.

I know I can use the TOC generator but then I lose the ability to use a visible ToC while editing.

DannyBen commented 7 months ago

Thanks for the report. I can confirm it seems like a bug in the redcarpet markdown engine.

I found these similar issues:

I added a simple reproduction case comment to the thread.

At this point, there is not much I can do about it, other than try to move to a different markdown renderer.

In the past, madness used RDiscount and CommonMarker - both had more issues than redcarpet. The only markdown renderer for Ruby I haven't tried in madness is Kramdown.

DannyBen commented 7 months ago

Version 1.2.0 is now released with support for pandoc as an alternative markdown renderer. When using renderer: pandoc in .madness.yml settings, nested lists should render properly.

Note that this requires having pandoc installed, but it should be as simple as brew install pandoc or any other OS package manager (apt / apk etc).

If you can confirm this works, or report that it doesn't, it will be appreciated.

xorguy commented 7 months ago

Hi. Updated docker container and set pandoc renderer and now the levels on a manually created ToC, not auto-ToC, are correctly rendered.

Thanks!