Problem Including Table of Contents
Sorry for rather simple question but I cannot find details on this anywhere. I am unable to generate a toc in the pdf. I ran the following commands:
npm install markdown-it --savenpm i markdown-it-table-of-contents --save
The markdownConverter.Parser.Toc.Indicator is the default ^\[\[\s*toc\s*\]\]
When I convert the following
Table Of Contents
[[toc]]
# 12
# we
### sdf
It looks like this:

Also, I am new to npm. After running those commands above, a node_modules folder was created in my working directory as well as a package-lock.json and a package.json. Is this correct?
Thx
Hello @karmeye
First of all - thanks for your interest in this project and for using MarkdownConverter!
Installing markdown-it and markdown-it-table-of-contents is unnecessary and doesn't change MarkdownConverter's behavior as MarkdownConverter is pre-packaged with all these modules and doesn't care what's inside VSCode's working directory, really.
Sadly I cannot reproduce the issue.
Could you please change the output-type to HTML (using the markdownConverter.ConversionType setting) and post the generated HTML file here?
Thank you for making this and your quick response!
Ah, good to hear that MarkdownConverter is pre-packaged with those. When I read the setting description
Enables the rendering of a table of contents using
markdown-it-table-of-contents
I didn't know what it was and thought that was the problem.
Here's the html: html.txt
I'm also getting this issue (VSCode/Win64/10), at first I thought proxy server, but that's been removed and I'm still getting double angle brackets where the TOC should be. I also noted a crash report from windows event view. See attached the .md, .html (requested), event exception. It produces the same result in multiple formats. I originally used default for chromium, but have also tried specifying the location of chrome.exe (makes it run much faster). User_Seed.md User_Seed_html.txt EVENT_LOG.txt
Thank you for making this and your quick response!
Ah, good to hear that MarkdownConverter is pre-packaged with those. When I read the setting description
Enables the rendering of a table of contents using
markdown-it-table-of-contentsI didn't know what it was and thought that was the problem.
Here's the html: html.txt
You're right - I might have to reverb this section of the README. This really does sound confusing now that you mention it 😅
I could reproduce the issue.
Looks like vscode's markdown-it instance doesn't get along with markdown-it-table-of-contents anymore.
To be honest, I have no idea on whether and how I can fix this. I'll investigate this at a later point. Stay tuned!
@karmeye, @0xbac I could pinpoint it down to the problem's source.
It looks just like this problem is caused by the Markdown Preview Mermaid Support extension.
No idea on how to fix it - neither do I know on how to fix it tbh 😅
I got the same problem when I added the Mermaid Extension. Before, the TOC was ok and after there was no more toc, only an empty tag. Deactivating the Mermaid extension does not solve the TOC problem. Question: is the Mermaid extension destroying the toc after it is generated? Could it be possible that swapping the extension effect might solve the problem? In mean, applying Mermaid first and makdown-it-table-of-content afterwards? I hope this can help.
Hello;
I am also encountering this issue, where [[toc]] is replaced with <>; Windows 10 22H2, VSCode 1.77.2, MarkdownConverter 5.2.1.
I have also found that the markdownConverter.Parser.Toc.Indicator setting doesn't seem to work? If I change it, for example, to \\/\\/toc, there is no substitution.
Hi @SmithPlatts Thanks for your feedback.
As mentioned before, this is most likely caused by the Markdown Preview Mermaid Support extension. Sadly, I don't know as to how this extension breaks markdown-it, so there is nothing much I can do.
You might want to disable this extension to make TOCs work.
Hi @manuth;
Cheers for the response.
I have uninstalled Markdown Preview Mermaid Support, and have also disabled the following other extensions:
Instant MarkdownMarkdown CheckboxesMarkdown FootnotesMarkdown yaml Preamble
I still have the following extensions installed:
Markdown EmojiMarkdown Preview Github Styling
I will try disabling these too, and then will try uninstalling them if there is still no improvement.
Would you like a dedicated issue raised for the markdownConverter.Parser.Toc.Indicator issue? This does not seem to be related.
Yes, that would help me a lot to keep track of it Thank you very much!
I gave up; disabled Markdown Converter TOC and I'm using Auto Markdown TOC now. It takes a little more management in your .md, but gives you much more control. I still use Markdown Converter for all the other features, file conversion, style support etc. and everything plays nicely with Markdown Preview Mermaid Support.
Hi @manuth;
It was the Markdown Preview Github Styling extension that was causing the issue for me; with it disabled, and all of the others enabled, TOC would generate correctly (using [[toc]]).
I also reinstalled Markdown Preview Mermaid Support, disabled Markdown Preview Github Styling, and retested and confirmed the issue.
In summary, either of these two extensions being enabled will cause [[toc]] to be replaced with <>:
Markdown Preview Github StylingMarkdown Preview Mermaid Support
Thank you so much for the recommendation! Another alternative for generating TOCs that I use quite often is the "Markdown All In One" extension. Definitely recommend this.
Hi @manuth;
It was the
Markdown Preview Github Stylingextension that was causing the issue for me; with it disabled, and all of the others enabled, TOC would generate correctly (using[[toc]]).I also reinstalled
Markdown Preview Mermaid Support, disabledMarkdown Preview Github Styling, and retested and confirmed the issue.In summary, either of these two extensions being enabled will cause
[[toc]]to be replaced with<>:
Markdown Preview Github StylingMarkdown Preview Mermaid Support
Thanks a lot for your research! I'll keep this in mind when working on this issue
Yes, that would help me a lot to keep track of it Thank you very much!
Issue #218 has been created.