From a8e02818f7de73b7d735cb2751f3842670518dc5 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Sun, 17 Dec 2017 13:39:32 +0100 Subject: [PATCH] Created Text Formatting (markdown) --- Text-Formatting.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Text-Formatting.md diff --git a/Text-Formatting.md b/Text-Formatting.md new file mode 100644 index 0000000..62727e4 --- /dev/null +++ b/Text-Formatting.md @@ -0,0 +1,47 @@ +Pyrogram, just like [Telegram Bot API](https://core.telegram.org/bots/api#formatting-options), supports basic Markdown formatting for messages; it uses the same syntax as Telegram Desktop's and is enabled by default. Beside bold, italic, and pre-formatted code, **Pyrogram does also support inline URLs and inline mentions of users**. + +Here is the complete syntax you can use when sending or editing messages: + +
+**bold text** + +__italic text__ + +[inline URL](http://www.example.com/) + +[inline mention of a user](tg://user?id=123456789) + +`inline fixed-width code` + +```block_language +pre-formatted fixed-width code block +``` ++ +## Code snippets + +- Inline entities (bold, italic, ...): + + ``` python + client.send_message( + chat_id="me", + text="**bold**, __italic__, [mention](tg://user?id=23122162), [url](https://pyrogram.ml), `code`" + ) + ``` + + **Note:** Mentions are only guaranteed to work if you have already contacted the user. + +- Code blocks: + +
+ client.send_message(
+ chat_id="me",
+ text=(
+ # Code block language is optional
+ "``` python\n"
+ "for i in range(10):\n"
+ " print(i)\n"
+ "```"
+ )
+ )
+
\ No newline at end of file