chatgpt-md-converter 0.3.11__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.
@@ -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
- rendered.append(prefix + stripped)
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
 
@@ -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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: chatgpt_md_converter
3
- Version: 0.3.11
3
+ Version: 0.3.12
4
4
  Summary: A package for converting markdown to HTML for chat Telegram bots
5
5
  Home-page: https://github.com/botfather-dev/formatter-chatgpt-telegram
6
6
  Author: Kostiantyn Kriuchkov
@@ -3,7 +3,7 @@ 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=A0QjL8eZTnlVupEQH3Ped9Ek81KLKS7cp4BdD-0R3tI,6653
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
@@ -11,10 +11,10 @@ chatgpt_md_converter/telegram_markdown/__init__.py,sha256=C0Oexz9brpdE-TqEpiAUV7
11
11
  chatgpt_md_converter/telegram_markdown/code_blocks.py,sha256=VPkSisvb6DiS5KAcq0OaX4sqR1YX4VgZvJEXZeAjIWk,3067
12
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=c9Wzs7DUumXgrgndCeHbCfV1qLzXVJlLHOtXC3Ne2Nk,1362
15
- chatgpt_md_converter/telegram_markdown/renderer.py,sha256=ZX0reJLVC_2Fvw26dnSSpK_xr_Kpfp9oTyQw57FCqu0,1957
16
- chatgpt_md_converter-0.3.11.dist-info/licenses/LICENSE,sha256=SDr2jeP-s2g4vf17-jdLXrrqA4_mU7L_RtSJlv4Y2mk,1077
17
- chatgpt_md_converter-0.3.11.dist-info/METADATA,sha256=qAj33YFtI7jrJX3rrxCsoSv-kJmrYl_z-jtFw3CguD8,6605
18
- chatgpt_md_converter-0.3.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- chatgpt_md_converter-0.3.11.dist-info/top_level.txt,sha256=T2o7csVtZgr-Pwm83aSUkZn0humJmDFNqW38tRSsNqw,21
20
- chatgpt_md_converter-0.3.11.dist-info/RECORD,,
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,,