markdown-pdf 1.1__tar.gz → 1.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.
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.1
2
+ Name: markdown_pdf
3
+ Version: 1.3
4
+ Summary: Markdown to pdf renderer
5
+ Home-page: https://github.com/vb64/markdown-pdf
6
+ Author: Vitaly Bogomolov
7
+ Author-email: mail@vitaly-bogomolov.ru
8
+ Project-URL: Bug Tracker, https://github.com/vb64/markdown-pdf/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: PyMuPDF==1.24.2
16
+ Requires-Dist: markdown-it-py==3.0.0
17
+
18
+ # Module markdown-pdf
19
+
20
+ [![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)
21
+ [![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)
22
+ [![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)
23
+ [![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)
24
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/markdown-pdf?label=pypi%20installs)](https://pypistats.org/packages/markdown-pdf)
25
+
26
+ The free, open source Python module `markdown-pdf` will create a PDF file from your content in `markdown` format.
27
+
28
+ When creating a PDF file you can:
29
+
30
+ - Use `UTF-8` encoded text in `markdown` in any language
31
+ - Embed images used in `markdown`
32
+ - Break text into pages in the desired order
33
+ - Create a TableOfContents (bookmarks) from markdown headings
34
+ - Tune the necessary elements using your CSS code
35
+ - Use different page sizes within single pdf
36
+ - Create tables in `markdown`
37
+
38
+ The module utilizes the functions of two great libraries.
39
+
40
+ - [markdown-it-py](https://github.com/executablebooks/markdown-it-py) to convert `markdown` to `html`.
41
+ - [PyMuPDF](https://github.com/pymupdf/PyMuPDF) to convert `html` to `pdf`.
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ pip install markdown-pdf
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ Create a pdf with TOC (bookmarks) from headings up to level 2.
52
+
53
+ ```python
54
+ from markdown_pdf import MarkdownPdf
55
+
56
+ pdf = MarkdownPdf(toc_level=2)
57
+ ```
58
+
59
+ Add the first section to the pdf. The title is not included in the table of contents.
60
+
61
+ ```python
62
+ from markdown_pdf import Section
63
+
64
+ pdf.add_section(Section("# Title\n", toc=False))
65
+ ```
66
+
67
+ Add a second section. In the pdf file it starts on a new page.
68
+ The title is centered using CSS, included in the table of contents of the pdf file, and an image from the file `img/python.png` is embedded on the page.
69
+
70
+ ```python
71
+ pdf.add_section(
72
+ Section("# Head1\n\n![python](img/python.png)\n\nbody\n"),
73
+ user_css="h1 {text-align:center;}"
74
+ )
75
+ ```
76
+
77
+ Add a third section. Two headings of different levels from this section are included in the TOC of the pdf file.
78
+ The section has landscape orientation of A4 pages.
79
+
80
+ ```python
81
+ pdf.add_section(Section("## Head2\n\n### Head3\n\n", paper_size="A4-L"))
82
+ ```
83
+
84
+ Add a fourth section with a table.
85
+
86
+ ```python
87
+
88
+ text = """# Section with Table
89
+
90
+ |TableHeader1|TableHeader2|
91
+ |--|--|
92
+ |Text1|Text2|
93
+ |ListCell|<ul><li>FirstBullet</li><li>SecondBullet</li></ul>|
94
+ """
95
+
96
+ pdf.add_section(Section(text))
97
+ ```
98
+
99
+ Set the properties of the pdf document.
100
+
101
+ ```python
102
+ pdf.meta["title"] = "User Guide"
103
+ pdf.meta["author"] = "Vitaly Bogomolov"
104
+ ```
105
+
106
+ Save to file.
107
+
108
+ ```python
109
+ pdf.save("guide.pdf")
110
+ ```
111
+
112
+ ![Pdf](img/with_toc.png)
113
+
114
+ ## Settings and options
115
+
116
+ The `Section` class defines a portion of `markdown` data,
117
+ which is processed according to the same rules.
118
+ The next `Section` data starts on a new page.
119
+
120
+ The `Section` class can set the following attributes.
121
+
122
+ - toc: whether to include the headers `<h1>` - `<h6>` of this section in the TOC. Default is True.
123
+ - root: the name of the root directory from which the image file paths starts in markdown. Default ".".
124
+ - paper_size: name of paper size, [as described here](https://pymupdf.readthedocs.io/en/latest/functions.html#paper_size). Default "A4".
125
+ - borders: size of borders. Default (36, 36, -36, -36).
126
+
127
+ The following document properties are available for assignment (dictionary `MarkdownPdf.meta`) with the default values indicated.
128
+
129
+ - `creationDate`: current date
130
+ - `modDate`: current date
131
+ - `creator`: "PyMuPDF library: https://pypi.org/project/PyMuPDF"
132
+ - `producer`: ""
133
+ - `title`: ""
134
+ - `author`: ""
135
+ - `subject`: ""
136
+ - `keywords`: ""
137
+
138
+ ## Example
139
+
140
+ As an example, you can download the [pdf file](examples/markdown_pdf.pdf) created from this md file.
141
+ This [Python script](makepdf.py) was used to create the PDF file.
@@ -0,0 +1,124 @@
1
+ # Module markdown-pdf
2
+
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)
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
+ [![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
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/markdown-pdf?label=pypi%20installs)](https://pypistats.org/packages/markdown-pdf)
8
+
9
+ The free, open source Python module `markdown-pdf` will create a PDF file from your content in `markdown` format.
10
+
11
+ When creating a PDF file you can:
12
+
13
+ - Use `UTF-8` encoded text in `markdown` in any language
14
+ - Embed images used in `markdown`
15
+ - Break text into pages in the desired order
16
+ - Create a TableOfContents (bookmarks) from markdown headings
17
+ - Tune the necessary elements using your CSS code
18
+ - Use different page sizes within single pdf
19
+ - Create tables in `markdown`
20
+
21
+ The module utilizes the functions of two great libraries.
22
+
23
+ - [markdown-it-py](https://github.com/executablebooks/markdown-it-py) to convert `markdown` to `html`.
24
+ - [PyMuPDF](https://github.com/pymupdf/PyMuPDF) to convert `html` to `pdf`.
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ pip install markdown-pdf
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ Create a pdf with TOC (bookmarks) from headings up to level 2.
35
+
36
+ ```python
37
+ from markdown_pdf import MarkdownPdf
38
+
39
+ pdf = MarkdownPdf(toc_level=2)
40
+ ```
41
+
42
+ Add the first section to the pdf. The title is not included in the table of contents.
43
+
44
+ ```python
45
+ from markdown_pdf import Section
46
+
47
+ pdf.add_section(Section("# Title\n", toc=False))
48
+ ```
49
+
50
+ Add a second section. In the pdf file it starts on a new page.
51
+ The title is centered using CSS, included in the table of contents of the pdf file, and an image from the file `img/python.png` is embedded on the page.
52
+
53
+ ```python
54
+ pdf.add_section(
55
+ Section("# Head1\n\n![python](img/python.png)\n\nbody\n"),
56
+ user_css="h1 {text-align:center;}"
57
+ )
58
+ ```
59
+
60
+ Add a third section. Two headings of different levels from this section are included in the TOC of the pdf file.
61
+ The section has landscape orientation of A4 pages.
62
+
63
+ ```python
64
+ pdf.add_section(Section("## Head2\n\n### Head3\n\n", paper_size="A4-L"))
65
+ ```
66
+
67
+ Add a fourth section with a table.
68
+
69
+ ```python
70
+
71
+ text = """# Section with Table
72
+
73
+ |TableHeader1|TableHeader2|
74
+ |--|--|
75
+ |Text1|Text2|
76
+ |ListCell|<ul><li>FirstBullet</li><li>SecondBullet</li></ul>|
77
+ """
78
+
79
+ pdf.add_section(Section(text))
80
+ ```
81
+
82
+ Set the properties of the pdf document.
83
+
84
+ ```python
85
+ pdf.meta["title"] = "User Guide"
86
+ pdf.meta["author"] = "Vitaly Bogomolov"
87
+ ```
88
+
89
+ Save to file.
90
+
91
+ ```python
92
+ pdf.save("guide.pdf")
93
+ ```
94
+
95
+ ![Pdf](img/with_toc.png)
96
+
97
+ ## Settings and options
98
+
99
+ The `Section` class defines a portion of `markdown` data,
100
+ which is processed according to the same rules.
101
+ The next `Section` data starts on a new page.
102
+
103
+ The `Section` class can set the following attributes.
104
+
105
+ - toc: whether to include the headers `<h1>` - `<h6>` of this section in the TOC. Default is True.
106
+ - root: the name of the root directory from which the image file paths starts in markdown. Default ".".
107
+ - paper_size: name of paper size, [as described here](https://pymupdf.readthedocs.io/en/latest/functions.html#paper_size). Default "A4".
108
+ - borders: size of borders. Default (36, 36, -36, -36).
109
+
110
+ The following document properties are available for assignment (dictionary `MarkdownPdf.meta`) with the default values indicated.
111
+
112
+ - `creationDate`: current date
113
+ - `modDate`: current date
114
+ - `creator`: "PyMuPDF library: https://pypi.org/project/PyMuPDF"
115
+ - `producer`: ""
116
+ - `title`: ""
117
+ - `author`: ""
118
+ - `subject`: ""
119
+ - `keywords`: ""
120
+
121
+ ## Example
122
+
123
+ As an example, you can download the [pdf file](examples/markdown_pdf.pdf) created from this md file.
124
+ This [Python script](makepdf.py) was used to create the PDF file.
@@ -1,4 +1,4 @@
1
- """Markdown to pdf converter baset on markdown_it and fitz."""
1
+ """Markdown to pdf converter based on markdown_it and fitz."""
2
2
  import io
3
3
  from markdown_it import MarkdownIt
4
4
  import fitz
@@ -38,7 +38,7 @@ class MarkdownPdf:
38
38
 
39
39
  # zero, commonmark, js-default, gfm-like
40
40
  # https://markdown-it-py.readthedocs.io/en/latest/using.html#quick-start
41
- self.m_d = (MarkdownIt(mode))
41
+ self.m_d = (MarkdownIt(mode).enable('table')) # Enable support for tables
42
42
 
43
43
  self.out_file = io.BytesIO()
44
44
  self.writer = fitz.DocumentWriter(self.out_file)
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.1
2
+ Name: markdown_pdf
3
+ Version: 1.3
4
+ Summary: Markdown to pdf renderer
5
+ Home-page: https://github.com/vb64/markdown-pdf
6
+ Author: Vitaly Bogomolov
7
+ Author-email: mail@vitaly-bogomolov.ru
8
+ Project-URL: Bug Tracker, https://github.com/vb64/markdown-pdf/issues
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: PyMuPDF==1.24.2
16
+ Requires-Dist: markdown-it-py==3.0.0
17
+
18
+ # Module markdown-pdf
19
+
20
+ [![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)
21
+ [![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)
22
+ [![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)
23
+ [![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)
24
+ [![PyPI - Downloads](https://img.shields.io/pypi/dm/markdown-pdf?label=pypi%20installs)](https://pypistats.org/packages/markdown-pdf)
25
+
26
+ The free, open source Python module `markdown-pdf` will create a PDF file from your content in `markdown` format.
27
+
28
+ When creating a PDF file you can:
29
+
30
+ - Use `UTF-8` encoded text in `markdown` in any language
31
+ - Embed images used in `markdown`
32
+ - Break text into pages in the desired order
33
+ - Create a TableOfContents (bookmarks) from markdown headings
34
+ - Tune the necessary elements using your CSS code
35
+ - Use different page sizes within single pdf
36
+ - Create tables in `markdown`
37
+
38
+ The module utilizes the functions of two great libraries.
39
+
40
+ - [markdown-it-py](https://github.com/executablebooks/markdown-it-py) to convert `markdown` to `html`.
41
+ - [PyMuPDF](https://github.com/pymupdf/PyMuPDF) to convert `html` to `pdf`.
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ pip install markdown-pdf
47
+ ```
48
+
49
+ ## Usage
50
+
51
+ Create a pdf with TOC (bookmarks) from headings up to level 2.
52
+
53
+ ```python
54
+ from markdown_pdf import MarkdownPdf
55
+
56
+ pdf = MarkdownPdf(toc_level=2)
57
+ ```
58
+
59
+ Add the first section to the pdf. The title is not included in the table of contents.
60
+
61
+ ```python
62
+ from markdown_pdf import Section
63
+
64
+ pdf.add_section(Section("# Title\n", toc=False))
65
+ ```
66
+
67
+ Add a second section. In the pdf file it starts on a new page.
68
+ The title is centered using CSS, included in the table of contents of the pdf file, and an image from the file `img/python.png` is embedded on the page.
69
+
70
+ ```python
71
+ pdf.add_section(
72
+ Section("# Head1\n\n![python](img/python.png)\n\nbody\n"),
73
+ user_css="h1 {text-align:center;}"
74
+ )
75
+ ```
76
+
77
+ Add a third section. Two headings of different levels from this section are included in the TOC of the pdf file.
78
+ The section has landscape orientation of A4 pages.
79
+
80
+ ```python
81
+ pdf.add_section(Section("## Head2\n\n### Head3\n\n", paper_size="A4-L"))
82
+ ```
83
+
84
+ Add a fourth section with a table.
85
+
86
+ ```python
87
+
88
+ text = """# Section with Table
89
+
90
+ |TableHeader1|TableHeader2|
91
+ |--|--|
92
+ |Text1|Text2|
93
+ |ListCell|<ul><li>FirstBullet</li><li>SecondBullet</li></ul>|
94
+ """
95
+
96
+ pdf.add_section(Section(text))
97
+ ```
98
+
99
+ Set the properties of the pdf document.
100
+
101
+ ```python
102
+ pdf.meta["title"] = "User Guide"
103
+ pdf.meta["author"] = "Vitaly Bogomolov"
104
+ ```
105
+
106
+ Save to file.
107
+
108
+ ```python
109
+ pdf.save("guide.pdf")
110
+ ```
111
+
112
+ ![Pdf](img/with_toc.png)
113
+
114
+ ## Settings and options
115
+
116
+ The `Section` class defines a portion of `markdown` data,
117
+ which is processed according to the same rules.
118
+ The next `Section` data starts on a new page.
119
+
120
+ The `Section` class can set the following attributes.
121
+
122
+ - toc: whether to include the headers `<h1>` - `<h6>` of this section in the TOC. Default is True.
123
+ - root: the name of the root directory from which the image file paths starts in markdown. Default ".".
124
+ - paper_size: name of paper size, [as described here](https://pymupdf.readthedocs.io/en/latest/functions.html#paper_size). Default "A4".
125
+ - borders: size of borders. Default (36, 36, -36, -36).
126
+
127
+ The following document properties are available for assignment (dictionary `MarkdownPdf.meta`) with the default values indicated.
128
+
129
+ - `creationDate`: current date
130
+ - `modDate`: current date
131
+ - `creator`: "PyMuPDF library: https://pypi.org/project/PyMuPDF"
132
+ - `producer`: ""
133
+ - `title`: ""
134
+ - `author`: ""
135
+ - `subject`: ""
136
+ - `keywords`: ""
137
+
138
+ ## Example
139
+
140
+ As an example, you can download the [pdf file](examples/markdown_pdf.pdf) created from this md file.
141
+ This [Python script](makepdf.py) was used to create the PDF file.
@@ -1,2 +1,2 @@
1
- PyMuPDF==1.23.3
1
+ PyMuPDF==1.24.2
2
2
  markdown-it-py==3.0.0
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = markdown_pdf
3
- version = 1.1
3
+ version = 1.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.23.3
22
+ PyMuPDF==1.24.2
23
23
  markdown-it-py==3.0.0
24
24
 
25
25
  [egg_info]
markdown_pdf-1.1/PKG-INFO DELETED
@@ -1,82 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: markdown_pdf
3
- Version: 1.1
4
- Summary: Markdown to pdf renderer
5
- Home-page: https://github.com/vb64/markdown-pdf
6
- Author: Vitaly Bogomolov
7
- Author-email: mail@vitaly-bogomolov.ru
8
- License: UNKNOWN
9
- Project-URL: Bug Tracker, https://github.com/vb64/markdown-pdf/issues
10
- Description: # markdown-pdf
11
-
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.11&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
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
- [![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
-
17
- This is a small Python class that links two libraries:
18
- [markdown-it-py](https://github.com/executablebooks/markdown-it-py) and
19
- [PyMuPDF](https://github.com/pymupdf/PyMuPDF).
20
- This class will create a PDF file from your set of `markdown` files.
21
-
22
- ## Installation
23
-
24
- ```bash
25
- pip install markdown-pdf
26
- ```
27
-
28
- ## Usage
29
-
30
- Create a pdf with TOC (bookmarks) from headings up to level 2.
31
-
32
- ```python
33
- from markdown_pdf import MarkdownPdf
34
-
35
- pdf = MarkdownPdf(toc_level=2)
36
- ```
37
-
38
- Add three sections of markdown to the pdf.
39
- Each section starts on a new page.
40
- Headings from the first section are not included in the TOC.
41
- The second section header is centered using CSS.
42
-
43
- ```python
44
- from markdown_pdf import Section
45
-
46
- pdf.add_section(Section("# Title\n", toc=False))
47
- pdf.add_section(Section("# Head1\n\nbody\n"), user_css="h1 {text-align:center;}")
48
- pdf.add_section(Section("## Head2\n\n### Head3\n\n"))
49
- ```
50
-
51
- Set the properties of the pdf document.
52
-
53
- ```python
54
- pdf.meta["title"] = "User Guide"
55
- pdf.meta["author"] = "Vitaly Bogomolov"
56
- ```
57
-
58
- Save to file.
59
-
60
- ```python
61
- pdf.save("guide.pdf")
62
- ```
63
-
64
- ![Pdf](img/with_toc.png)
65
-
66
- The `Section` class defines a portion of `markdown` data,
67
- which is processed according to the same rules.
68
- The next `Section` data starts on a new page.
69
-
70
- The `Section` class can set the following attributes.
71
-
72
- - toc: whether to include the headers `<h1>` - `<h6>` of this section in the TOC. Default is True.
73
- - root: the name of the root directory from which the image file paths starts in markdown. Default ".".
74
- - paper_size: name of paper size, [as described here](https://pymupdf.readthedocs.io/en/latest/functions.html#paper_size). Default "A4".
75
- - borders: size of borders. Default (36, 36, -36, -36).
76
-
77
- Platform: UNKNOWN
78
- Classifier: Programming Language :: Python :: 3
79
- Classifier: License :: OSI Approved :: MIT License
80
- Classifier: Operating System :: OS Independent
81
- Requires-Python: >=3.8
82
- Description-Content-Type: text/markdown
@@ -1,66 +0,0 @@
1
- # markdown-pdf
2
-
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.11&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
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
- [![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
-
8
- This is a small Python class that links two libraries:
9
- [markdown-it-py](https://github.com/executablebooks/markdown-it-py) and
10
- [PyMuPDF](https://github.com/pymupdf/PyMuPDF).
11
- This class will create a PDF file from your set of `markdown` files.
12
-
13
- ## Installation
14
-
15
- ```bash
16
- pip install markdown-pdf
17
- ```
18
-
19
- ## Usage
20
-
21
- Create a pdf with TOC (bookmarks) from headings up to level 2.
22
-
23
- ```python
24
- from markdown_pdf import MarkdownPdf
25
-
26
- pdf = MarkdownPdf(toc_level=2)
27
- ```
28
-
29
- Add three sections of markdown to the pdf.
30
- Each section starts on a new page.
31
- Headings from the first section are not included in the TOC.
32
- The second section header is centered using CSS.
33
-
34
- ```python
35
- from markdown_pdf import Section
36
-
37
- pdf.add_section(Section("# Title\n", toc=False))
38
- pdf.add_section(Section("# Head1\n\nbody\n"), user_css="h1 {text-align:center;}")
39
- pdf.add_section(Section("## Head2\n\n### Head3\n\n"))
40
- ```
41
-
42
- Set the properties of the pdf document.
43
-
44
- ```python
45
- pdf.meta["title"] = "User Guide"
46
- pdf.meta["author"] = "Vitaly Bogomolov"
47
- ```
48
-
49
- Save to file.
50
-
51
- ```python
52
- pdf.save("guide.pdf")
53
- ```
54
-
55
- ![Pdf](img/with_toc.png)
56
-
57
- The `Section` class defines a portion of `markdown` data,
58
- which is processed according to the same rules.
59
- The next `Section` data starts on a new page.
60
-
61
- The `Section` class can set the following attributes.
62
-
63
- - toc: whether to include the headers `<h1>` - `<h6>` of this section in the TOC. Default is True.
64
- - root: the name of the root directory from which the image file paths starts in markdown. Default ".".
65
- - paper_size: name of paper size, [as described here](https://pymupdf.readthedocs.io/en/latest/functions.html#paper_size). Default "A4".
66
- - borders: size of borders. Default (36, 36, -36, -36).
@@ -1,82 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: markdown-pdf
3
- Version: 1.1
4
- Summary: Markdown to pdf renderer
5
- Home-page: https://github.com/vb64/markdown-pdf
6
- Author: Vitaly Bogomolov
7
- Author-email: mail@vitaly-bogomolov.ru
8
- License: UNKNOWN
9
- Project-URL: Bug Tracker, https://github.com/vb64/markdown-pdf/issues
10
- Description: # markdown-pdf
11
-
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.11&style=plastic&branch=main)](https://github.com/vb64/markdown-pdf/actions?query=workflow%3Apy3)
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
- [![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
-
17
- This is a small Python class that links two libraries:
18
- [markdown-it-py](https://github.com/executablebooks/markdown-it-py) and
19
- [PyMuPDF](https://github.com/pymupdf/PyMuPDF).
20
- This class will create a PDF file from your set of `markdown` files.
21
-
22
- ## Installation
23
-
24
- ```bash
25
- pip install markdown-pdf
26
- ```
27
-
28
- ## Usage
29
-
30
- Create a pdf with TOC (bookmarks) from headings up to level 2.
31
-
32
- ```python
33
- from markdown_pdf import MarkdownPdf
34
-
35
- pdf = MarkdownPdf(toc_level=2)
36
- ```
37
-
38
- Add three sections of markdown to the pdf.
39
- Each section starts on a new page.
40
- Headings from the first section are not included in the TOC.
41
- The second section header is centered using CSS.
42
-
43
- ```python
44
- from markdown_pdf import Section
45
-
46
- pdf.add_section(Section("# Title\n", toc=False))
47
- pdf.add_section(Section("# Head1\n\nbody\n"), user_css="h1 {text-align:center;}")
48
- pdf.add_section(Section("## Head2\n\n### Head3\n\n"))
49
- ```
50
-
51
- Set the properties of the pdf document.
52
-
53
- ```python
54
- pdf.meta["title"] = "User Guide"
55
- pdf.meta["author"] = "Vitaly Bogomolov"
56
- ```
57
-
58
- Save to file.
59
-
60
- ```python
61
- pdf.save("guide.pdf")
62
- ```
63
-
64
- ![Pdf](img/with_toc.png)
65
-
66
- The `Section` class defines a portion of `markdown` data,
67
- which is processed according to the same rules.
68
- The next `Section` data starts on a new page.
69
-
70
- The `Section` class can set the following attributes.
71
-
72
- - toc: whether to include the headers `<h1>` - `<h6>` of this section in the TOC. Default is True.
73
- - root: the name of the root directory from which the image file paths starts in markdown. Default ".".
74
- - paper_size: name of paper size, [as described here](https://pymupdf.readthedocs.io/en/latest/functions.html#paper_size). Default "A4".
75
- - borders: size of borders. Default (36, 36, -36, -36).
76
-
77
- Platform: UNKNOWN
78
- Classifier: Programming Language :: Python :: 3
79
- Classifier: License :: OSI Approved :: MIT License
80
- Classifier: Operating System :: OS Independent
81
- Requires-Python: >=3.8
82
- Description-Content-Type: text/markdown
File without changes
File without changes
File without changes