Markdown TOC exported to PDF?

Hello. I am finding the auto-generated table of contents from the Markdown file I’m working on to be super useful. I was hoping to be able to keep the TOC when I exported the MD file, yet I’m not seeing that.

Is there some other format I could export to where the TOC gets exported as well?


Currently, the only format that would preserve the TOC would be HTML.

Okay, that could work… If I exported to HTML, and then captured that back into DT3 as a PDF, that would kind of sort of work, right?

I’m not at my Mac right now but I don’t believe the links will be preserved.

Rats. Okay then - if you can throw that into the request queue, I’d appreciate it. Either to export to PDF with TOC, or to preserve the links when capturing back into PDF.


As an FYI, I just exported As Website, and the image links are all broken.

I’m not quite sure if that’s what you’re looking for so just forget this if it is of no help for you:

MultiMarkdown generates a table of content by {{TOC}}. It’s not a separate file and it will only work if you export to a MultiMarkdown editor.

Okay, that’s fine. I have no idea of what MMD editors are out there. Can you recommend any?

MultiMarkdown Composer by Fletcher Penney who created the MultiMarkdown specification is one.

1 Like

Jim’s recommendation is the best choice. MMD Composer isn’t a beauty but comes with great functionality and has always the latest MMD engine because Fletcher is its developer.

Marked 2 is not a MultiMarkdown editor but just a viewer that works well with MMD. And it comes with a number of export options (caveat: PDF export broken on Big Sur).

On the iOS/iPadOS side of things: 1Writer, Drafts and probably some more.

I use iA Writer on osx and iOS for the .md files. The .md editor in DevonThink is very basic and not really usefull for me. I store all .md files within DevonThink devided by project number or topic.

The big plus of an external editor is that the .md file can be moved to the desktop easy while the behaviour stays identical. And it is ready to share with my team over the shared cloud.

And I use picocms at nextcloud to present the .md file to clients in html style over the net.

Welcome @Sibren

Thanks for sharing your thoughts.


I am not able to see TOC rendered in Devonthink inside of the file by using: {{TOC}} i.e. it seems that DT does not recognize this syntax? All I get is this in the viewer:

Is this WAI?

Do you have headings set in the document?

Yes @BLUEFROG I use the headings triggering the according css. The toc (side menu) is now showing H2 only, which is exactly enough in my case. Keeping the md file and rendered html simple.

A screen capture of the source and preview could help.

I do not know whether the issue is still open but I could export Markdown to pdf while keeping the {{TOC}} links active this way:

  1. Export Markdown from DT3 to html
  2. Import html in Libreoffice then export to PDF.

I can confirm the behaviour. See

for a sample MD file and the PDF generated from it with DT. While the links in the TOC are active for the MD preview, they’re not in the PDF.

@cgrunenberg: bug or feature?

Edit: You can generate a working PDF toc with pandoc and wkhtmltopdf. However, the resulting PDF is a bit weird in that it might break a table or a code block between pages. So you gain some and you lose some.

Neither nor. Just not supported currently.

1 Like

Ahh glad found this thread for explanation. Spent sometime to figure out why my PDF TOC not linking when it works on DT3.

Any indication when DT3 will support TOC links in PDF?