Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mdbook-pdf-outline doesn't render anything #18

Closed
deobald opened this issue Apr 7, 2023 · 6 comments
Closed

mdbook-pdf-outline doesn't render anything #18

deobald opened this issue Apr 7, 2023 · 6 comments

Comments

@deobald
Copy link

deobald commented Apr 7, 2023

Results of RUST_BACKTRACE=full RUST_LOG=trace mdbook build are here:

https://gist.github.com/deobald/36e2f95b26371ad825f002010835bfde

book.toml is here:

https://gist.github.com/deobald/30451a715c99c765b2636925c1aec366

Repo is here:

https://github.com/endatabas/endb-book

Description

Running mdbook_pdf_outline.py with some debugging print statements, it seems that the calls to writer.add_outline_item are never executed. As a result, book/pdf-outline/output.pdf does not contain the table of contents as a page at the beginning. I didn't try to diagnose why all the nested conditionals were failing, since I'm guessing that will be far easier for @HollowMan6

Feel free to remove [preprocessor.toc] while debugging -- pdf-outline was failing before I added that. I was hoping it could be a workaround, but it's for chapter-level ToCs.

@HollowMan6
Copy link
Owner

Hi! Everything is OK when I tried to generate the outline with your configuration.

output.pdf

so I assume that you didn't use my fork of mdbook for generating the pdf, which I have mentioned in https://github.com/HollowMan6/mdbook-pdf#common-issues

should be used with mdbook-pdf and the rust-lang/mdBook#1738 mentioned in Common Issues 2 for fixing the broken links in print.html

You can install that by cargo install --git https://github.com/HollowMan6/mdBook mdbook

@HollowMan6
Copy link
Owner

Just updated the explanation in README, sorry if this is causing any confusion like you said in README: https://github.com/endatabas/endb-book/tree/008b39a820366fd6b67fb915a7faabd329e324cb#bugs

Unfortunately I don't know why mdbook upstream is so slow at accepting my PR, hope this can get accepted soon one day. rust-lang/mdBook#1738

@deobald
Copy link
Author

deobald commented Apr 8, 2023

Ah, I think I may have actually misunderstood what mdbook-pdf-outline actually does. I assumed it created an automatic Table of Contents page at the beginning of the PDF. The output.pdf you linked doesn't contain that, but it does contain a (sidebar) outline in the PDF viewer. For my own sanity: that's all it's expected to do, correct?

@HollowMan6
Copy link
Owner

HollowMan6 commented Apr 8, 2023

Yes, that's correct. Actually there's nothing complicated if you want to create an automatic Table of Contents page at the beginning of the PDF, no need to use any other additional tools, just link the src/SUMMARY.md itself in the file:

You can use the following script for a demo.

echo -e "# Table of Content\n- [Table of Content](./SUMMARY.md)" | cat - src/SUMMARY.md > temp && mv temp src/SUMMARY.md

Ah, I think I may have actually misunderstood what mdbook-pdf-outline actually does. I assumed it created an automatic Table of Contents page at the beginning of the PDF. The output.pdf you linked doesn't contain that, but it does contain a (sidebar) outline in the PDF viewer. For my own sanity: that's all it's expected to do, correct?

@deobald
Copy link
Author

deobald commented Apr 11, 2023

As a heads-up to anyone stumbling upon this thread later: duplicating SUMMARY.md into TOC.md makes sense as a simple stop-gap but will contain broken links, internally. You'll probably want to rip all the Markdown links out with sed if you use a script to (re)build TOC.md.

@HollowMan6
Copy link
Owner

Hi! For broken links, you can use my fork of mdbook mentioned in common issue 2 to fix it. https://github.com/HollowMan6/mdbook-pdf#common-issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants