Generate outline for pdf generated by `mdbook-pdf`.
Project description
Introduction
Generate outline for pdf files generated using mdbook-pdf
Motivation
mdbook-pdf
is good, but...
In example, I create a simple book, and I use mdbook-pdf
as renderer to export pdf
with outline.
cd example/a_book
docker run --rm -v $PWD:/book hollowman6/mdbook-pdf
You can see the generated pdf
in ./example/a_book/book/pdf-outline/output.pdf
.
Also, you can see the generated HTML
in ./example/a_book/book/html
Different outline
The sidebar of HTML
is like: html_outline, which is what I want.
The outline of pdf is like: pdf_outline, a little bit different with html. Every heading in markdown file is shown in the outline, without any order.
The reason
The pdf outline is generated by mdbook_pdf_outline. It base on the print.html
rendered by HTML engine, and the outline is generated by HTML Headings
, not SUMMARY.md
. Therefore, if there are any headings in your markdown file, they will appear in the outline.
Quick Start
Install
pip3 install mdbook_pdf_summary
Run
1. Generate pdf
pushd example/a_book
docker run --rm -v $PWD:/book hollowman6/mdbook-pdf
popd
2. Generate outline based on SUMMARY.md
mdbook-pdf-summary --html_path ./example/a_book/book/html/print.html --pdf_path ./example/a_book/book/pdf/output.pdf --summary_path ./example/a_book/src/SUMMARY.md --output_path ./output_with_outline.pdf
Or, use docker image:
docker run --rm -v $PWD:/book cmq2525/mdbook_pdf_summary --entrypoint mdbook-pdf-summary
The above command will generate output_with_outline.pdf
in your $WORKDIR
, the outline is like: summary_outline, same as SUMMARY.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for mdbook_pdf_summary-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d21648f2639f0160f0d8d6e33eeedfe068a5716d3d15a712a382577550cff7ce |
|
MD5 | 2f3e317d1bb575e1ef754ff8fa31e55a |
|
BLAKE2b-256 | e26485676a3420454eede2eeace302963a649e9b9f7bf0edfe70b4d7ee54ee75 |