Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 69 additions & 18 deletions docs/source/topics/text-formatting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,23 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the

~~strike~~

> blockquote
>blockquote

|>escaped blockquote

>Fist line of multi line blockquote
>Block quotation continued
>Block quotation continued
>Block quotation continued
>The last line of the block quotation

**>
The expandable block quotation started right after the previous block quotation
It is separated from the previous block quotation by expandable syntax
Expandable block quotation continued
Hidden by default part of the expandable block quotation started
Expandable block quotation continued
The last line of the expandable block quotation with the expandability mark<**

`inline fixed-width code`

Expand All @@ -80,7 +96,7 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the

.. code-block:: python

from pyrogram import enums
from pyrogram.enums import ParseMode

await app.send_message(
chat_id="me",
Expand All @@ -96,8 +112,27 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.ParseMode.MARKDOWN` to the
"for i in range(10):\n"
" print(i)"
"```"

">blockquote\n"

"|>escaped blockquote\n"

">Fist line of multi line blockquote\n"
">Block quotation continued\n"
">Block quotation continued\n"
">Block quotation continued\n"
">The last line of the block quotation"

"**>\n"
"The expandable block quotation started right after the previous block quotation\n"
"It is separated from the previous block quotation by expandable syntax\n"
"Expandable block quotation continued\n"
"Hidden by default part of the expandable block quotation started\n"
"Expandable block quotation continued\n"
"The last line of the expandable block quotation with the expandability mark<**"

),
parse_mode=enums.ParseMode.MARKDOWN
parse_mode=ParseMode.MARKDOWN
)

HTML Style
Expand Down Expand Up @@ -136,24 +171,40 @@ To strictly use this mode, pass :obj:`~pyrogram.enums.HTML` to the *parse_mode*

.. code-block:: python

from pyrogram import enums
from pyrogram.enums import ParseMode

await app.send_message(
chat_id="me",
text=(
"<b>bold</b>, "
"<i>italic</i>, "
"<u>underline</u>, "
"<s>strike</s>, "
"<spoiler>spoiler</spoiler>, "
"<a href=\"https://telegramplayground.github.io/pyrogram/\">URL</a>, "
"<code>code</code>\n\n"
"<b>bold</b>, <strong>bold</strong>"
"<i>italic</i>, <em>italic</em>"
"<u>underline</u>, <ins>underline</ins>"
"<s>strike</s>, <strike>strike</strike>, <del>strike</del>"
"<spoiler>spoiler</spoiler>\n\n"

"<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"

"<a href=\"https://telegramplayground.github.io/pyrogram/\">inline URL</a> "
"<a href=\"tg://user?id=23122162\">inline mention of a user</a>\n"
"<emoji id=5368324170671202286>👍</emoji> "
"<code>inline fixed-width code</code> "
"<pre>pre-formatted fixed-width code block</pre>\n\n"
"<pre language='py'>"
"for i in range(10):\n"
" print(i)"
"</pre>"
"</pre>\n\n"

"<blockquote>Block quotation started"
"Block quotation continued"
"The last line of the block quotation</blockquote>"
"<blockquote expandable>Expandable block quotation started"
"Expandable block quotation continued"
"Expandable block quotation continued"
"Hidden by default part of the block quotation started"
"Expandable block quotation continued"
"The last line of the block quotation</blockquote>"
),
parse_mode=enums.ParseMode.HTML
parse_mode=ParseMode.HTML
)

.. note::
Expand Down Expand Up @@ -194,10 +245,10 @@ If you don't like this behaviour you can always choose to only enable either Mar

.. code-block:: python

from pyrogram import enums
from pyrogram.enums import ParseMode

await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=enums.ParseMode.MARKDOWN)
await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=enums.ParseMode.HTML)
await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=ParseMode.MARKDOWN)
await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=ParseMode.HTML)

Result:

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

.. code-block:: python

from pyrogram import enums
from pyrogram.enums import ParseMode

await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=enums.ParseMode.DISABLED)
await app.send_message(chat_id="me", text="**bold**, <i>italic</i>", parse_mode=ParseMode.DISABLED)

Result:

Expand Down
Loading