Markdown to pdf renderer
Project description
markdown-pdf
This is a small Python class that links two libraries: markdown-it-py and PyMuPDF.
This class will create a PDF file from your set of markdown
files.
Installation
pip install markdown-pdf
Usage
from markdown_pdf import Section, MarkdownPdf
pdf = MarkdownPdf(toc_level=2)
pdf.add_section(Section("# Title\n", toc=False))
pdf.add_section(Section("# Head1\n\nbody\n"))
pdf.add_section(Section("## Head2\n\n### Head3\n\n"))
pdf.save(self.build("with_toc.pdf"))
The Section
class defines a portion of markdown
data, which is processed according to the same rules.
The next Section
data starts on a new page.
The Section
class can set the following attributes.
- toc: whether to include the headers
<h1>
-<h6>
of this section in the TOC. Default is True. - root: the name of the root directory from which the image file paths starts in markdown. Default ".".
- paper_size: name of paper size, as described here. Default "A4".
- borders: size of borders. Default (36, 36, -36, -36).
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
markdown_pdf-1.0.tar.gz
(3.9 kB
view hashes)
Built Distribution
Close
Hashes for markdown_pdf-1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83c2825b8fecb2c931ed5c1017beff34a166e2d07182bc1c79f57fe44da9b927 |
|
MD5 | c07398a9e5222a2cf10b6b36399a700a |
|
BLAKE2b-256 | de865c147c2dc3fbd2602fcc32cb75b41a7d657e3e9c44bf08d1d566bdf7a050 |