chatgpt-md-converter 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl
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.
- chatgpt_md_converter/converters.py +2 -1
- chatgpt_md_converter/formatters.py +3 -6
- chatgpt_md_converter/telegram_formatter.py +5 -4
- {chatgpt_md_converter-0.1.1.dist-info → chatgpt_md_converter-0.1.2.dist-info}/METADATA +1 -1
- chatgpt_md_converter-0.1.2.dist-info/RECORD +11 -0
- chatgpt_md_converter-0.1.1.dist-info/RECORD +0 -11
- {chatgpt_md_converter-0.1.1.dist-info → chatgpt_md_converter-0.1.2.dist-info}/LICENSE +0 -0
- {chatgpt_md_converter-0.1.1.dist-info → chatgpt_md_converter-0.1.2.dist-info}/WHEEL +0 -0
- {chatgpt_md_converter-0.1.1.dist-info → chatgpt_md_converter-0.1.2.dist-info}/top_level.txt +0 -0
|
@@ -16,6 +16,7 @@ def split_by_tag(out_text: str, md_tag: str, html_tag: str) -> str:
|
|
|
16
16
|
Splits the text by markdown tag and replaces it with the specified HTML tag.
|
|
17
17
|
"""
|
|
18
18
|
tag_pattern = re.compile(
|
|
19
|
-
r"{}(.*?){}".format(re.escape(md_tag), re.escape(md_tag)),
|
|
19
|
+
r"(?<!\w){}(.*?){}(?!\w)".format(re.escape(md_tag), re.escape(md_tag)),
|
|
20
|
+
re.DOTALL,
|
|
20
21
|
)
|
|
21
22
|
return tag_pattern.sub(r"<{}>\1</{}>".format(html_tag, html_tag), out_text)
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import re
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
def combine_blockquotes(text: str) -> str:
|
|
5
2
|
"""
|
|
6
|
-
Combines multiline blockquotes into a single blockquote.
|
|
3
|
+
Combines multiline blockquotes into a single blockquote while keeping the \n characters.
|
|
7
4
|
"""
|
|
8
5
|
lines = text.split("\n")
|
|
9
6
|
combined_lines = []
|
|
@@ -17,7 +14,7 @@ def combine_blockquotes(text: str) -> str:
|
|
|
17
14
|
else:
|
|
18
15
|
if in_blockquote:
|
|
19
16
|
combined_lines.append(
|
|
20
|
-
"<blockquote>" + "
|
|
17
|
+
"<blockquote>" + "\n".join(blockquote_lines) + "</blockquote>"
|
|
21
18
|
)
|
|
22
19
|
blockquote_lines = []
|
|
23
20
|
in_blockquote = False
|
|
@@ -25,7 +22,7 @@ def combine_blockquotes(text: str) -> str:
|
|
|
25
22
|
|
|
26
23
|
if in_blockquote:
|
|
27
24
|
combined_lines.append(
|
|
28
|
-
"<blockquote>" + "
|
|
25
|
+
"<blockquote>" + "\n".join(blockquote_lines) + "</blockquote>"
|
|
29
26
|
)
|
|
30
27
|
|
|
31
28
|
return "\n".join(combined_lines)
|
|
@@ -26,6 +26,7 @@ def telegram_format(text: str) -> str:
|
|
|
26
26
|
|
|
27
27
|
# Nested Bold and Italic
|
|
28
28
|
output = re.sub(r"\*\*\*(.*?)\*\*\*", r"<b><i>\1</i></b>", output)
|
|
29
|
+
output = re.sub(r"\_\_\_(.*?)\_\_\_", r"<u><i>\1</i></u>", output)
|
|
29
30
|
|
|
30
31
|
# Process markdown formatting tags (bold, underline, italic, strikethrough)
|
|
31
32
|
# and convert them to their respective HTML tags
|
|
@@ -39,14 +40,14 @@ def telegram_format(text: str) -> str:
|
|
|
39
40
|
output = re.sub(r"【[^】]+】", "", output)
|
|
40
41
|
|
|
41
42
|
# Convert links
|
|
42
|
-
output = re.sub(r"
|
|
43
|
-
|
|
44
|
-
# Convert lists
|
|
45
|
-
output = re.sub(r"^\s*[\-\*] (.+)", r"• \1", output, flags=re.MULTILINE)
|
|
43
|
+
output = re.sub(r"!?\[(.*?)\]\((.*?)\)", r'<a href="\2">\1</a>', output)
|
|
46
44
|
|
|
47
45
|
# Convert headings
|
|
48
46
|
output = re.sub(r"^\s*#+ (.+)", r"<b>\1</b>", output, flags=re.MULTILINE)
|
|
49
47
|
|
|
48
|
+
# Convert unordered lists, preserving indentation
|
|
49
|
+
output = re.sub(r"^(\s*)[\-\*] (.+)", r"\1• \2", output, flags=re.MULTILINE)
|
|
50
|
+
|
|
50
51
|
# Step 4: Reinsert the converted HTML code blocks
|
|
51
52
|
output = reinsert_code_blocks(output, code_blocks)
|
|
52
53
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
chatgpt_md_converter/__init__.py,sha256=AfkikySkXsJ8HKQcSlU7B1KBHz54QCGJ7MO5Ka9oWRM,79
|
|
2
|
+
chatgpt_md_converter/converters.py,sha256=nfbKCcYCAYBk_0RQntCVQFQgAlEUWrGtLWULE1wETmU,657
|
|
3
|
+
chatgpt_md_converter/extractors.py,sha256=RNwo57_6jCe-HoX5eCvvZcjSTc2uPax-6QEtXqXA5QQ,1880
|
|
4
|
+
chatgpt_md_converter/formatters.py,sha256=gG_SavtZI0BVl7SqkwGZ_usCB89ZPpAQWofpDUd9DzU,878
|
|
5
|
+
chatgpt_md_converter/helpers.py,sha256=9CtBeMzKYrymECNPl0MXsW0Vscp4A02a64a5z0sVWqE,261
|
|
6
|
+
chatgpt_md_converter/telegram_formatter.py,sha256=3XSNWda_5LKRShjZlkO-D7c1Uq77pfvUGlhqliEO0eU,2007
|
|
7
|
+
chatgpt_md_converter-0.1.2.dist-info/LICENSE,sha256=SDr2jeP-s2g4vf17-jdLXrrqA4_mU7L_RtSJlv4Y2mk,1077
|
|
8
|
+
chatgpt_md_converter-0.1.2.dist-info/METADATA,sha256=roSPyHowfr_bCIlyWkja5ozrq3j8zjAQI1cI_0Iqodo,3086
|
|
9
|
+
chatgpt_md_converter-0.1.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
10
|
+
chatgpt_md_converter-0.1.2.dist-info/top_level.txt,sha256=T2o7csVtZgr-Pwm83aSUkZn0humJmDFNqW38tRSsNqw,21
|
|
11
|
+
chatgpt_md_converter-0.1.2.dist-info/RECORD,,
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
chatgpt_md_converter/__init__.py,sha256=AfkikySkXsJ8HKQcSlU7B1KBHz54QCGJ7MO5Ka9oWRM,79
|
|
2
|
-
chatgpt_md_converter/converters.py,sha256=-SbsAiMetDZVkC7PrEQrrKlpoagnUycCL1WNBozd7u0,635
|
|
3
|
-
chatgpt_md_converter/extractors.py,sha256=RNwo57_6jCe-HoX5eCvvZcjSTc2uPax-6QEtXqXA5QQ,1880
|
|
4
|
-
chatgpt_md_converter/formatters.py,sha256=T85JwXI7t3PpqAHvkV7FFrmBar6pYRYLVLpET0TeRp0,856
|
|
5
|
-
chatgpt_md_converter/helpers.py,sha256=9CtBeMzKYrymECNPl0MXsW0Vscp4A02a64a5z0sVWqE,261
|
|
6
|
-
chatgpt_md_converter/telegram_formatter.py,sha256=3TrQpuVm1P4Qv1ZMrcBwD7sA2GI-yCDGuTUwUZSlw3E,1896
|
|
7
|
-
chatgpt_md_converter-0.1.1.dist-info/LICENSE,sha256=SDr2jeP-s2g4vf17-jdLXrrqA4_mU7L_RtSJlv4Y2mk,1077
|
|
8
|
-
chatgpt_md_converter-0.1.1.dist-info/METADATA,sha256=635E9EVpEVMP1fpbPAuDl0x_Y9cu3Ye5WfnwdjnWeYc,3086
|
|
9
|
-
chatgpt_md_converter-0.1.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
10
|
-
chatgpt_md_converter-0.1.1.dist-info/top_level.txt,sha256=T2o7csVtZgr-Pwm83aSUkZn0humJmDFNqW38tRSsNqw,21
|
|
11
|
-
chatgpt_md_converter-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|