orzih / mkdocs-with-pdf

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

Links on second level toc items aren't working #15

Closed JanoschDeurer closed 4 years ago

JanoschDeurer commented 4 years ago

I'm using material for mkdocs. There are two different behaviors. If I don't set a first level heading for a page, mkdocs automatically renders the one that is given by the nav entry in the config file. In this case mkdocs-with-pdf throws the following error:

ERROR   -  Content discarded: target points to undefined anchor "('string', '#')"

The entry in the toc then points to #.

If I set the heading on the page manually by adding

# exampleHeading

to my markdown file I get the following error instead:

ERROR   -  No anchor #example/path/:exampleheading for internal URI reference

The resulting toc entry is then no longer a link meaning it is not clickable.

JanoschDeurer commented 4 years ago

After looking at this a bit closer there seems to be a general problem with all links towards level two headings.

orzih commented 4 years ago

Thank you for your report.

I added the id to first top level heading where it was missing. Please check it.

MalkmusT commented 4 years ago

Most of our links for second level toc entries are working now. We are still facing some failling links due to encoding issues, which is part of a separate Issue.

orzih commented 4 years ago

Thank you for the confirmation work.

We are still facing some failling links due to encoding issues, which is part of a separate Issue.

Could you provide a "mkdocs project" that this problem occurs?

JanoschDeurer commented 4 years ago

I dug a little deeper and the remaining problem is indeed with the encoding of special characters. I'm gonna open another ticket with a minimal project setup to repoduce and close this one :) Thansk for fixing this so fast :)