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
File details
Details for the file mdbook_pdf_summary-0.1.1.tar.gz
.
File metadata
- Download URL: mdbook_pdf_summary-0.1.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5679afa6a394cda54669d8b58e568620279270c76355ef9250d9581b1f9a561d |
|
MD5 | 8746f3a3cce859fd299983e2b4566814 |
|
BLAKE2b-256 | f4398121b0c410c335b83212f5354ffcbdd222fc1cedcd0adca7c3bd0e447af7 |
File details
Details for the file mdbook_pdf_summary-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: mdbook_pdf_summary-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d21648f2639f0160f0d8d6e33eeedfe068a5716d3d15a712a382577550cff7ce |
|
MD5 | 2f3e317d1bb575e1ef754ff8fa31e55a |
|
BLAKE2b-256 | e26485676a3420454eede2eeace302963a649e9b9f7bf0edfe70b4d7ee54ee75 |