orzih / mkdocs-with-pdf

Generate a single PDF file from MkDocs repository.
MIT License
332 stars 77 forks source link

Add support for permalink #22

Closed JanoschDeurer closed 4 years ago

JanoschDeurer commented 4 years ago

Material for mkdocs supports the permalink markdown extension as described here: https://squidfunk.github.io/mkdocs-material/setup/setting-up-navigation/#table-of-contents

It would be great to have support for that in the pdf, in the sense that when a link points to the anchor like this

[My subsection](#mysubsection)

it is correctly resolved.

orzih commented 4 years ago

permalink is the effect of mouse over. Materials for mkdocs is set to hide them when printing, see here. I think it's because printed paper becomes noisy. What do you think about it?

And now, this plugin is remove all permalink https://github.com/orzih/mkdocs-with-pdf/blob/6ca26b48fbf1a73e37c1f2a3c9817113ed326c27/mkdocs_with_pdf/generator.py#L74-L76

JanoschDeurer commented 4 years ago

Yes, you are right there should not be anything shown in the pdf. However I think it would be nice if the links would still work.

orzih commented 4 years ago

Does that mean a direct link from the browser? I think only limited browsers such as Acrobat Reader(plugin), Firefox support it.

Also, the output PDF already contains a link point to the element with 'id' attribute (no permalink option required). However, the link point name will be changed to accommodate a single PDF.

eg. https://example.com/pdf/document.pdf#setup/setting-up-navigation/:permalink

<dt><code id="setup/setting-up-navigation/:permalink">permalink</code></dt>

Please check the output HTML using the debug_html option.

JanoschDeurer commented 4 years ago

I think this was an error on my side, with the update of #21 most of the links to anchors on the same site are working. I currently think that it is not related to permalink. I'll investigate further and provide an example mkdocs when I figure out the problem. Thanks again :)