mdpdf icon indicating copy to clipboard operation
mdpdf copied to clipboard

Table of content in PDF

Open mirko3000 opened this issue 2 years ago • 1 comments

Is there a way to generate the PDF outline/table of content? I do have a ToC within the document with working links (using markdown-toc), but the generated PDF does not have the native outline based on my headings.

mirko3000 avatar Apr 29 '22 11:04 mirko3000

This isn't something supported by mdpdf right now but I think it would be a good addition. I don't really use mdpdf much myself right now so it's not something I can spend time doing but I'd be open to a pull request if anyone fancied building it.

Mdpdf is quite a thin wrapper around the md -> html -> pdf conversion, you'd probably need to do an additional transformation during the initial md -> html step. Right now we don't have anything which really interrogates the markdown aside from converting relative links to absolute so we'd probably need some kind of markdown parser to yank out all the headers, format a ToC, and insert it into the correct place.

elliotblackburn avatar Apr 29 '22 14:04 elliotblackburn