Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mdbook_pdf_summary-0.1.1.tar.gz (5.5 kB view hashes)

Uploaded Source

Built Distribution

mdbook_pdf_summary-0.1.1-py3-none-any.whl (6.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page