Shell script to generate pdf table of contents from headings

Link to the script

I threw together a somewhat hacky solution to get at least a sidebar table of contents in the pdfs that I dump out of obsidian. It’s not super important to me that the TOC is actually imbedded into the body text, I just wanted to have the navigation ability and it hasn’t been implemented into pdf exports from the editor yet.

If you’d like to work this to fit your exported document style you can do as I did as well and replace the toml recipe with the heading style from your own theme that you’re using.

I explain in a bit more detail on my repo how I did it and how it works. Perhaps somebody would like to take this and expand.

**Edit: Added a picture for clarity
image

3 Likes

Sounds very interesting – the lack of a TOC (preferably embedded) is a major gripe of mine about the PDF export capability. I’m not a python person but I’ll give it a whirl when I have a chance. Thanks!

1 Like