zhaoterryy / mkdocs-pdf-export-plugin

An MkDocs plugin to export content pages as PDF files
MIT License
318 stars 42 forks source link

External Markdown Links are pointing to physical location of HTML #28

Closed sebastienlevert closed 5 years ago

sebastienlevert commented 5 years ago

I'm currently using 0.5.0 and I'm having an issue with the PDF generation of a pretty large documentation base. We are using a lot of internal links between our documentation pages and sections and we're seeing something new in our PDF generated file (We are almost certain that this works, at some point...).

When using a link like the following in our documentation [Topic](topic.md), this works nicely in our website but produces a link to the physical generated file (file:///Users/vsts/agent/2.144.0/work/1/s/site/topic/). It does that in our CI/CD environment and does it also in all our local builds.

Anything we should change to make sure the links are clickable through the PDF document?

Thanks!

zhaoterryy commented 5 years ago

I'm certain the links were working at some point. I probably.. broke something.

Can you confirm if 0.3.0/0.4.0 had this working?

zhaoterryy commented 5 years ago

I'm mistaken, this was never working.

Naturally would expect these links to point to the appropriate sections and PDFs so I'll aim to fix this for the next release.

zhaoterryy commented 5 years ago

Relevant part of WeasyPrint docs:

They can be either internal, to another part of the same document (eg. <a href="#pdf">) or external, to an URL. External links are resolved to absolute URLs: <a href="/news/"> on the WeasyPrint website would always point to http://weasyprint.org/news/ in PDF files.

Still investigating - could be a missing upstream feature.

sebastienlevert commented 5 years ago

In that case, it has to be within the document if it comes from another MD file I guess. We would still need external URL references, but internal for everything generated from a MD file...

zhaoterryy commented 5 years ago

Upstream issue: https://github.com/Kozea/WeasyPrint/issues/772

zhaoterryy commented 5 years ago

You can test the fix by installing v0.5.1b0 -

pip3 install mkdocs-pdf-export-plugin==0.5.1b0

sebastienlevert commented 5 years ago

Currently, the images seem to be having issues with the latest beta version.

image

zhaoterryy commented 5 years ago

Fixed in v0.5.1b1!

sebastienlevert commented 5 years ago

I am seeing a new behaviour now where links within a document are now broken again with 0.5.2b2. Is there any specific format we should use for our links within the HTML that would be picked up when generated in PDF? I'm currently using the following :

[title of the article](../folder/article.md).

The result is that I'm seeing is a link to an relative link like an URL instead of an anchor withint the PDF document :

image

Thanks!