Skip to content

Commit 366d337

Browse files
authored
Update markdown.py: Fix Blockquote. (#147)
* Update markdown.py: Fix Blockquote. * Update text-formatting.rst: add documentation for MD blockquote * Update markdown.py: fix an edgecase regarding quote escape character. * minor update Closes #74
1 parent 758f2d2 commit 366d337

File tree

2 files changed

+229
-90
lines changed

2 files changed

+229
-90
lines changed

docs/source/topics/text-formatting.rst

Lines changed: 69 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,23 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the
5959
6060
~~strike~~
6161
62-
> blockquote
62+
>blockquote
63+
64+
|>escaped blockquote
65+
66+
>Fist line of multi line blockquote
67+
>Block quotation continued
68+
>Block quotation continued
69+
>Block quotation continued
70+
>The last line of the block quotation
71+
72+
**>
73+
The expandable block quotation started right after the previous block quotation
74+
It is separated from the previous block quotation by expandable syntax
75+
Expandable block quotation continued
76+
Hidden by default part of the expandable block quotation started
77+
Expandable block quotation continued
78+
The last line of the expandable block quotation with the expandability mark<**
6379
6480
`inline fixed-width code`
6581
@@ -80,7 +96,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the
8096

8197
.. code-block:: python
8298
83-
from pyrogram import enums
99+
from pyrogram.enums import ParseMode
84100
85101
await app.send_message(
86102
chat_id="me",
@@ -96,8 +112,27 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the
96112
"for i in range(10):\n"
97113
" print(i)"
98114
"```"
115+
116+
">blockquote\n"
117+
118+
"|>escaped blockquote\n"
119+
120+
">Fist line of multi line blockquote\n"
121+
">Block quotation continued\n"
122+
">Block quotation continued\n"
123+
">Block quotation continued\n"
124+
">The last line of the block quotation"
125+
126+
"**>\n"
127+
"The expandable block quotation started right after the previous block quotation\n"
128+
"It is separated from the previous block quotation by expandable syntax\n"
129+
"Expandable block quotation continued\n"
130+
"Hidden by default part of the expandable block quotation started\n"
131+
"Expandable block quotation continued\n"
132+
"The last line of the expandable block quotation with the expandability mark<**"
133+
99134
),
100-
parse_mode=enums.ParseMode.MARKDOWN
135+
parse_mode=ParseMode.MARKDOWN
101136
)
102137
103138
HTML Style
@@ -136,24 +171,40 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.HTML` to the *parse_mode*
136171

137172
.. code-block:: python
138173
139-
from pyrogram import enums
174+
from pyrogram.enums import ParseMode
140175
141176
await app.send_message(
142177
chat_id="me",
143178
text=(
144-
"<b>bold</b>, "
145-
"<i>italic</i>, "
146-
"<u>underline</u>, "
147-
"<s>strike</s>, "
148-
"<spoiler>spoiler</spoiler>, "
149-
"<a href=\"https://telegramplayground.github.io/pyrogram/\">URL</a>, "
150-
"<code>code</code>\n\n"
179+
"<b>bold</b>, <strong>bold</strong>"
180+
"<i>italic</i>, <em>italic</em>"
181+
"<u>underline</u>, <ins>underline</ins>"
182+
"<s>strike</s>, <strike>strike</strike>, <del>strike</del>"
183+
"<spoiler>spoiler</spoiler>\n\n"
184+
185+
"<b>bold <i>italic bold <s>italic bold strike <spoiler>italic bold strike spoiler</spoiler></s> <u>underline italic bold</u></i> bold</b>\n\n"
186+
187+
"<a href=\"https://telegramplayground.github.io/pyrogram/\">inline URL</a> "
188+
"<a href=\"tg://user?id=23122162\">inline mention of a user</a>\n"
189+
"<emoji id=5368324170671202286>👍</emoji> "
190+
"<code>inline fixed-width code</code> "
191+
"<pre>pre-formatted fixed-width code block</pre>\n\n"
151192
"<pre language='py'>"
152193
"for i in range(10):\n"
153194
" print(i)"
154-
"</pre>"
195+
"</pre>\n\n"
196+
197+
"<blockquote>Block quotation started"
198+
"Block quotation continued"
199+
"The last line of the block quotation</blockquote>"
200+
"<blockquote expandable>Expandable block quotation started"
201+
"Expandable block quotation continued"
202+
"Expandable block quotation continued"
203+
"Hidden by default part of the block quotation started"
204+
"Expandable block quotation continued"
205+
"The last line of the block quotation</blockquote>"
155206
),
156-
parse_mode=enums.ParseMode.HTML
207+
parse_mode=ParseMode.HTML
157208
)
158209
159210
.. note::
@@ -194,10 +245,10 @@ If you don't like this behaviour you can always choose to only enable either Mar
194245

195246
.. code-block:: python
196247
197-
from pyrogram import enums
248+
from pyrogram.enums import ParseMode
198249
199-
await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=enums.ParseMode.MARKDOWN)
200-
await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=enums.ParseMode.HTML)
250+
await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=ParseMode.MARKDOWN)
251+
await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=ParseMode.HTML)
201252
202253
Result:
203254

@@ -210,9 +261,9 @@ The text will be sent as-is.
210261

211262
.. code-block:: python
212263
213-
from pyrogram import enums
264+
from pyrogram.enums import ParseMode
214265
215-
await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=enums.ParseMode.DISABLED)
266+
await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=ParseMode.DISABLED)
216267
217268
Result:
218269

0 commit comments

Comments
 (0)