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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: markdown_pdf
3
- Version: 1.3.1
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
  [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/markdown-pdf/pep257.yml?label=Pep257&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apep257)
13
- [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/markdown-pdf/py3.yml?label=Python%203.8-3.12&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
13
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/markdown-pdf/py3.yml?label=Python%203.8-3.13&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
14
14
  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/27b53043bff34f07bfb79ee1672b7ba0)](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
15
15
  [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/27b53043bff34f07bfb79ee1672b7ba0)](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
16
16
  [![PyPI - Downloads](https://img.shields.io/pypi/dm/markdown-pdf?label=pypi%20installs)](https://pypistats.org/packages/markdown-pdf)
@@ -1,7 +1,7 @@
1
1
  # Module markdown-pdf
2
2
 
3
3
  [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/markdown-pdf/pep257.yml?label=Pep257&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apep257)
4
- [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/markdown-pdf/py3.yml?label=Python%203.8-3.12&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
4
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/markdown-pdf/py3.yml?label=Python%203.8-3.13&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
5
5
  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/27b53043bff34f07bfb79ee1672b7ba0)](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
6
6
  [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/27b53043bff34f07bfb79ee1672b7ba0)](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
7
7
  [![PyPI - Downloads](https://img.shields.io/pypi/dm/markdown-pdf?label=pypi%20installs)](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) -> 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
- story = fitz.Story(html=self.m_d.render(section.text), archive=section.root, user_css=user_css)
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
- def save(self, file_name: str) -> None:
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.1
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
  [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/markdown-pdf/pep257.yml?label=Pep257&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apep257)
13
- [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/markdown-pdf/py3.yml?label=Python%203.8-3.12&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
13
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vb64/markdown-pdf/py3.yml?label=Python%203.8-3.13&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
14
14
  [![Codacy Badge](https://app.codacy.com/project/badge/Grade/27b53043bff34f07bfb79ee1672b7ba0)](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
15
15
  [![Codacy Badge](https://app.codacy.com/project/badge/Coverage/27b53043bff34f07bfb79ee1672b7ba0)](https://app.codacy.com/gh/vb64/markdown-pdf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
16
16
  [![PyPI - Downloads](https://img.shields.io/pypi/dm/markdown-pdf?label=pypi%20installs)](https://pypistats.org/packages/markdown-pdf)
@@ -1,2 +1,2 @@
1
- PyMuPDF==1.24.2
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.1
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.2
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