markdown-pdf 1.3.1__tar.gz → 1.3.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/PKG-INFO +2 -2
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/README.md +1 -1
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/markdown_pdf/__init__.py +7 -3
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/markdown_pdf.egg-info/PKG-INFO +2 -2
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/markdown_pdf.egg-info/requires.txt +1 -1
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/setup.cfg +2 -2
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/LICENSE +0 -0
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/MANIFEST.in +0 -0
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/markdown_pdf.egg-info/SOURCES.txt +0 -0
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/markdown_pdf.egg-info/dependency_links.txt +0 -0
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/markdown_pdf.egg-info/top_level.txt +0 -0
- {markdown_pdf-1.3.1 → markdown_pdf-1.3.3}/pyproject.toml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: markdown_pdf
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: Markdown to pdf renderer
|
|
5
5
|
Home-page: https://github.com/vb64/markdown-pdf
|
|
6
6
|
Author: Vitaly Bogomolov
|
|
@@ -10,7 +10,7 @@ Project-URL: Bug Tracker, https://github.com/vb64/markdown-pdf/issues
|
|
|
10
10
|
Description: # Module markdown-pdf
|
|
11
11
|
|
|
12
12
|
[](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apep257)
|
|
13
|
-
[](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
|
|
14
14
|
[](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
15
15
|
[](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
|
|
16
16
|
[](https://pypistats.org/packages/markdown-pdf)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Module markdown-pdf
|
|
2
2
|
|
|
3
3
|
[](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apep257)
|
|
4
|
-
[](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
|
|
5
5
|
[](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
6
6
|
[](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
|
|
7
7
|
[](https://pypistats.org/packages/markdown-pdf)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"""Markdown to pdf converter based on markdown_it and fitz."""
|
|
2
2
|
import io
|
|
3
3
|
import typing
|
|
4
|
+
import pathlib
|
|
4
5
|
from markdown_it import MarkdownIt
|
|
5
6
|
import fitz
|
|
6
7
|
|
|
@@ -68,11 +69,12 @@ class MarkdownPdf:
|
|
|
68
69
|
elpos.rect[1], # top of written rectangle (use for TOC)
|
|
69
70
|
))
|
|
70
71
|
|
|
71
|
-
def add_section(self, section: Section, user_css: typing.Optional[str] = None) ->
|
|
72
|
+
def add_section(self, section: Section, user_css: typing.Optional[str] = None) -> str:
|
|
72
73
|
"""Add markdown section to pdf."""
|
|
73
74
|
rect = fitz.paper_rect(section.paper_size)
|
|
74
75
|
where = rect + section.borders
|
|
75
|
-
|
|
76
|
+
html = self.m_d.render(section.text)
|
|
77
|
+
story = fitz.Story(html=html, archive=section.root, user_css=user_css)
|
|
76
78
|
more = 1
|
|
77
79
|
while more: # loop outputting the story
|
|
78
80
|
self.page += 1
|
|
@@ -82,7 +84,9 @@ class MarkdownPdf:
|
|
|
82
84
|
story.draw(device)
|
|
83
85
|
self.writer.end_page()
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
return html
|
|
88
|
+
|
|
89
|
+
def save(self, file_name: typing.Union[str, pathlib.Path]) -> None:
|
|
86
90
|
"""Save pdf to file."""
|
|
87
91
|
self.writer.close()
|
|
88
92
|
doc = fitz.open("pdf", self.out_file)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: markdown-pdf
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.3
|
|
4
4
|
Summary: Markdown to pdf renderer
|
|
5
5
|
Home-page: https://github.com/vb64/markdown-pdf
|
|
6
6
|
Author: Vitaly Bogomolov
|
|
@@ -10,7 +10,7 @@ Project-URL: Bug Tracker, https://github.com/vb64/markdown-pdf/issues
|
|
|
10
10
|
Description: # Module markdown-pdf
|
|
11
11
|
|
|
12
12
|
[](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apep257)
|
|
13
|
-
[](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
|
|
14
14
|
[](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
15
15
|
[](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
|
|
16
16
|
[](https://pypistats.org/packages/markdown-pdf)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
PyMuPDF==1.24.
|
|
1
|
+
PyMuPDF==1.24.6
|
|
2
2
|
markdown-it-py==3.0.0
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[metadata]
|
|
2
2
|
name = markdown_pdf
|
|
3
|
-
version = 1.3.
|
|
3
|
+
version = 1.3.3
|
|
4
4
|
author = Vitaly Bogomolov
|
|
5
5
|
author_email = mail@vitaly-bogomolov.ru
|
|
6
6
|
description = Markdown to pdf renderer
|
|
@@ -19,7 +19,7 @@ package_dir =
|
|
|
19
19
|
packages = markdown_pdf
|
|
20
20
|
python_requires = >=3.8
|
|
21
21
|
install_requires =
|
|
22
|
-
PyMuPDF==1.24.
|
|
22
|
+
PyMuPDF==1.24.6
|
|
23
23
|
markdown-it-py==3.0.0
|
|
24
24
|
|
|
25
25
|
[egg_info]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|