markdown_convert 1.2.32__tar.gz → 1.2.34__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_convert-1.2.32 → markdown_convert-1.2.34}/PKG-INFO +2 -1
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/markdown_convert/default.css +12 -3
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/markdown_convert/modules/transform.py +20 -15
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/pyproject.toml +2 -1
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/.gitignore +0 -0
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/LICENSE +0 -0
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/README.md +0 -0
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/markdown_convert/__init__.py +0 -0
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/markdown_convert/__main__.py +0 -0
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/markdown_convert/code.css +0 -0
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/markdown_convert/modules/__init__.py +0 -0
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/markdown_convert/modules/constants.py +0 -0
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/markdown_convert/modules/convert.py +0 -0
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/markdown_convert/modules/resources.py +0 -0
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/markdown_convert/modules/utils.py +0 -0
- {markdown_convert-1.2.32 → markdown_convert-1.2.34}/markdown_convert/modules/validate.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: markdown_convert
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.34
|
|
4
4
|
Summary: Convert Markdown files to PDF from your command line.
|
|
5
5
|
Project-URL: homepage, https://github.com/Julynx/markdown_convert
|
|
6
6
|
Author-email: Julio Cabria <juliocabria@tutanota.com>
|
|
@@ -11,6 +11,7 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Requires-Python: <3.15,>=3.9
|
|
13
13
|
Requires-Dist: argsdict==1.0.0
|
|
14
|
+
Requires-Dist: beautifulsoup4>=4.14.3
|
|
14
15
|
Requires-Dist: latex2mathml>=3.78.1
|
|
15
16
|
Requires-Dist: markdown2<3,>=2.4.13
|
|
16
17
|
Requires-Dist: playwright>=1.57.0
|
|
@@ -170,6 +170,7 @@ table {
|
|
|
170
170
|
border-collapse: collapse;
|
|
171
171
|
margin-top: var(--top-margin);
|
|
172
172
|
text-align: left;
|
|
173
|
+
width: 100%;
|
|
173
174
|
table-layout: auto;
|
|
174
175
|
}
|
|
175
176
|
|
|
@@ -185,11 +186,19 @@ th,
|
|
|
185
186
|
td {
|
|
186
187
|
padding: 0.5em 0.75em;
|
|
187
188
|
border: 1px solid #ccc;
|
|
188
|
-
|
|
189
|
+
overflow-wrap: break-word;
|
|
190
|
+
vertical-align: top;
|
|
189
191
|
}
|
|
190
192
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
th {
|
|
194
|
+
white-space: normal;
|
|
195
|
+
word-break: keep-all;
|
|
196
|
+
hyphens: auto;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
td {
|
|
200
|
+
white-space: normal;
|
|
201
|
+
word-break: break-word;
|
|
193
202
|
}
|
|
194
203
|
|
|
195
204
|
/* Page breaks */
|
|
@@ -4,6 +4,8 @@ Module for transforming HTML content.
|
|
|
4
4
|
|
|
5
5
|
import re
|
|
6
6
|
|
|
7
|
+
from bs4 import BeautifulSoup
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
def create_html_document(html_content, css_content, csp):
|
|
9
11
|
"""
|
|
@@ -30,28 +32,31 @@ def create_html_document(html_content, css_content, csp):
|
|
|
30
32
|
</html>"""
|
|
31
33
|
|
|
32
34
|
|
|
33
|
-
def create_sections(
|
|
35
|
+
def create_sections(html_string):
|
|
34
36
|
"""
|
|
35
|
-
|
|
36
|
-
|
|
37
|
+
Wraps each h2 and its following content in a <section> tag.
|
|
38
|
+
Avoids wrapping h2 tags that are inside <code> blocks.
|
|
39
|
+
|
|
37
40
|
Args:
|
|
38
|
-
|
|
41
|
+
html_string (str): The input HTML string.
|
|
39
42
|
Returns:
|
|
40
|
-
HTML
|
|
43
|
+
str: The modified HTML string with h2 sections wrapped.
|
|
41
44
|
"""
|
|
42
|
-
|
|
45
|
+
soup = BeautifulSoup(html_string, "html.parser")
|
|
43
46
|
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
for second_level_header in soup.find_all("h2"):
|
|
48
|
+
new_section = soup.new_tag("section")
|
|
49
|
+
second_level_header.insert_before(new_section)
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
current = second_level_header
|
|
52
|
+
while current is not None and (
|
|
53
|
+
current == second_level_header or current.name != "h2"
|
|
54
|
+
):
|
|
55
|
+
next_sibling = current.next_sibling
|
|
56
|
+
new_section.append(current)
|
|
57
|
+
current = next_sibling
|
|
53
58
|
|
|
54
|
-
return
|
|
59
|
+
return str(soup)
|
|
55
60
|
|
|
56
61
|
|
|
57
62
|
def render_mermaid_diagrams(html, *, nonce):
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "markdown_convert"
|
|
7
|
-
version = "1.2.
|
|
7
|
+
version = "1.2.34"
|
|
8
8
|
description = "Convert Markdown files to PDF from your command line."
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Julio Cabria", email = "juliocabria@tutanota.com" },
|
|
@@ -23,6 +23,7 @@ dependencies = [
|
|
|
23
23
|
"pygments>=2.17.2,<3",
|
|
24
24
|
"latex2mathml>=3.78.1",
|
|
25
25
|
"playwright>=1.57.0",
|
|
26
|
+
"beautifulsoup4>=4.14.3",
|
|
26
27
|
]
|
|
27
28
|
|
|
28
29
|
[project.urls]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|