chatgpt-md-converter 0.3.10__py3-none-any.whl → 0.3.12__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/html_markdown/handlers.py +3 -2
- chatgpt_md_converter/telegram_markdown/code_blocks.py +1 -1
- chatgpt_md_converter/telegram_markdown/inline.py +1 -1
- chatgpt_md_converter/telegram_markdown/preprocess.py +4 -0
- chatgpt_md_converter/telegram_markdown/renderer.py +1 -2
- {chatgpt_md_converter-0.3.10.dist-info → chatgpt_md_converter-0.3.12.dist-info}/METADATA +1 -1
- {chatgpt_md_converter-0.3.10.dist-info → chatgpt_md_converter-0.3.12.dist-info}/RECORD +10 -10
- {chatgpt_md_converter-0.3.10.dist-info → chatgpt_md_converter-0.3.12.dist-info}/WHEEL +0 -0
- {chatgpt_md_converter-0.3.10.dist-info → chatgpt_md_converter-0.3.12.dist-info}/licenses/LICENSE +0 -0
- {chatgpt_md_converter-0.3.10.dist-info → chatgpt_md_converter-0.3.12.dist-info}/top_level.txt +0 -0
|
@@ -169,11 +169,12 @@ def _handle_blockquote(node: Node, state: RenderState) -> str:
|
|
|
169
169
|
expandable = "expandable" in node.attrs
|
|
170
170
|
rendered: list[str] = []
|
|
171
171
|
for index, line in enumerate(lines):
|
|
172
|
-
prefix = "**>" if expandable and index == 0 else ">"
|
|
173
172
|
stripped = line.rstrip("\r")
|
|
174
173
|
if expandable:
|
|
175
|
-
|
|
174
|
+
marker = ">**" if index == 0 else ">"
|
|
175
|
+
rendered.append(f"{marker} {stripped}" if stripped else marker)
|
|
176
176
|
else:
|
|
177
|
+
prefix = ">"
|
|
177
178
|
rendered.append(f"{prefix} {stripped}" if stripped else prefix)
|
|
178
179
|
return "\n".join(rendered)
|
|
179
180
|
|
|
@@ -67,7 +67,7 @@ def extract_and_convert_code_blocks(text: str):
|
|
|
67
67
|
.replace("<", "<")
|
|
68
68
|
.replace(">", ">")
|
|
69
69
|
)
|
|
70
|
-
placeholder = f"
|
|
70
|
+
placeholder = f"CODEBLOCKPLACEHOLDER_{len(placeholders)}_"
|
|
71
71
|
placeholders.append(placeholder)
|
|
72
72
|
if language:
|
|
73
73
|
html_block = f'<pre><code class="language-{language}">{escaped}</code></pre>'
|
|
@@ -60,7 +60,7 @@ def extract_inline_code_snippets(text: str):
|
|
|
60
60
|
|
|
61
61
|
def replacer(match: re.Match[str]) -> str:
|
|
62
62
|
snippet = match.group(1)
|
|
63
|
-
placeholder = f"
|
|
63
|
+
placeholder = f"INLINECODEPLACEHOLDER_{len(placeholders)}_"
|
|
64
64
|
placeholders.append(placeholder)
|
|
65
65
|
snippets[placeholder] = snippet
|
|
66
66
|
return placeholder
|
|
@@ -14,6 +14,10 @@ def combine_blockquotes(text: str) -> str:
|
|
|
14
14
|
in_blockquote = True
|
|
15
15
|
is_expandable = True
|
|
16
16
|
blockquote_lines.append(line[3:].strip())
|
|
17
|
+
elif line.startswith(">**") and (len(line) == 3 or line[3].isspace()):
|
|
18
|
+
in_blockquote = True
|
|
19
|
+
is_expandable = True
|
|
20
|
+
blockquote_lines.append(line[3:].strip())
|
|
17
21
|
elif line.startswith(">"):
|
|
18
22
|
if not in_blockquote:
|
|
19
23
|
in_blockquote = True
|
|
@@ -12,9 +12,8 @@ from .preprocess import combine_blockquotes
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
def telegram_format(text: str) -> str:
|
|
15
|
-
text = combine_blockquotes(text)
|
|
16
|
-
|
|
17
15
|
output, block_map = extract_and_convert_code_blocks(text)
|
|
16
|
+
output = combine_blockquotes(output)
|
|
18
17
|
output, inline_snippets = extract_inline_code_snippets(output)
|
|
19
18
|
|
|
20
19
|
output = convert_html_chars(output)
|
|
@@ -3,18 +3,18 @@ chatgpt_md_converter/html_splitter.py,sha256=DdjJx0I-A9rZHOxS-0LXsy7YUrgrkrtdeqZ
|
|
|
3
3
|
chatgpt_md_converter/html_to_markdown.py,sha256=XlLpQD7W_AooWrvTtvrGVwfPPa80tDKWuT1iT6Vzygw,174
|
|
4
4
|
chatgpt_md_converter/telegram_formatter.py,sha256=w3tjoSdRH_UdoFmGeXe7I47dhDIceXuGOA1oCLMnUmM,87
|
|
5
5
|
chatgpt_md_converter/html_markdown/escaping.py,sha256=wJA4vUJQVcxpkJ4sCIYIWKaqffb_O72R93H81hTgTxA,1808
|
|
6
|
-
chatgpt_md_converter/html_markdown/handlers.py,sha256=
|
|
6
|
+
chatgpt_md_converter/html_markdown/handlers.py,sha256=zKGRg__41SP7bKs8jodOWAEZJb2FNaC5_raoUiWdBUE,6696
|
|
7
7
|
chatgpt_md_converter/html_markdown/renderer.py,sha256=en-fAr3Bhmm4ZndDaPKV8nLVQ_7HpS_NFBSWcrQporY,438
|
|
8
8
|
chatgpt_md_converter/html_markdown/state.py,sha256=sxbz0ucCakI0KgR86EMZx0nvfU1oiqgVUofujFTeKoo,432
|
|
9
9
|
chatgpt_md_converter/html_markdown/tree.py,sha256=ryohrhO2X5QepZev3087qPoGmMznqHDwH00TNGoW6a4,2154
|
|
10
10
|
chatgpt_md_converter/telegram_markdown/__init__.py,sha256=C0Oexz9brpdE-TqEpiAUV78TsZdSrnnH_5yYpEJ03Us,131
|
|
11
|
-
chatgpt_md_converter/telegram_markdown/code_blocks.py,sha256=
|
|
12
|
-
chatgpt_md_converter/telegram_markdown/inline.py,sha256=
|
|
11
|
+
chatgpt_md_converter/telegram_markdown/code_blocks.py,sha256=VPkSisvb6DiS5KAcq0OaX4sqR1YX4VgZvJEXZeAjIWk,3067
|
|
12
|
+
chatgpt_md_converter/telegram_markdown/inline.py,sha256=MPzj5VpDqrlvPy69CCwUIOsWgtgIFfbB4CliV5Wz-TY,2207
|
|
13
13
|
chatgpt_md_converter/telegram_markdown/postprocess.py,sha256=jUf01tAIqHQ1NxNlVGsvU-Yw8SDOHtMoS7MUzaQLf_8,775
|
|
14
|
-
chatgpt_md_converter/telegram_markdown/preprocess.py,sha256=
|
|
15
|
-
chatgpt_md_converter/telegram_markdown/renderer.py,sha256=
|
|
16
|
-
chatgpt_md_converter-0.3.
|
|
17
|
-
chatgpt_md_converter-0.3.
|
|
18
|
-
chatgpt_md_converter-0.3.
|
|
19
|
-
chatgpt_md_converter-0.3.
|
|
20
|
-
chatgpt_md_converter-0.3.
|
|
14
|
+
chatgpt_md_converter/telegram_markdown/preprocess.py,sha256=k9XBtwgXkh07SlsqbdcZHwOMHhUGOjiIbOehO5wBnu0,1561
|
|
15
|
+
chatgpt_md_converter/telegram_markdown/renderer.py,sha256=39ZehJq6PVWm-sigeBz7vCycwzEmV4Mwiw36jkGIgXI,1960
|
|
16
|
+
chatgpt_md_converter-0.3.12.dist-info/licenses/LICENSE,sha256=SDr2jeP-s2g4vf17-jdLXrrqA4_mU7L_RtSJlv4Y2mk,1077
|
|
17
|
+
chatgpt_md_converter-0.3.12.dist-info/METADATA,sha256=CWvPYndrqJad_RD-zJABwdDSPhVhkcuXzVwf8Z7BTjw,6605
|
|
18
|
+
chatgpt_md_converter-0.3.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
19
|
+
chatgpt_md_converter-0.3.12.dist-info/top_level.txt,sha256=T2o7csVtZgr-Pwm83aSUkZn0humJmDFNqW38tRSsNqw,21
|
|
20
|
+
chatgpt_md_converter-0.3.12.dist-info/RECORD,,
|
|
File without changes
|
{chatgpt_md_converter-0.3.10.dist-info → chatgpt_md_converter-0.3.12.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{chatgpt_md_converter-0.3.10.dist-info → chatgpt_md_converter-0.3.12.dist-info}/top_level.txt
RENAMED
|
File without changes
|