Message formatting in Telegram

Markdown markup

To mark up the text correctly in the desired block (the markup is located under the text input field of the message), strictly follow the following steps:

  1. Put the required text in the response field.

If you're using variables in the text, you should not specify them at this stage. Otherwise, the variable syntax will be broken and the #{} characters will also be escaped, and the variable will not appear in the text.

  1. We turn on "Markdown in Telegram". This way, escape characters will be added to your text.

  2. We select the text ** or _ _, etc.

Special characters:

Bold text — put asterisks on both sides: * here is the text* Italics — underlining: _text_ Underlined text — two lower underscores on both sides: __text__ Strikethrough text - is a tilde on both sides of the text: ~text~ Link in the text: [text in square brackets](link in parentheses): [inline URL] (http://www.example.com/) Mention of the user Telegram: [text in square brackets] (link to the user in parentheses). You can use #{platform_id} after the equals sign in the link. [inline mention of a user](tg://user?id=123456789) Text in the code form — put a reverse apostrophe on both sides of the text: inline fixed-width code Hidden text or spoiler - use || on both sides of the text

  1. Next, mark up the desired text using special characters.

Example:

Markup example

Result:

When working with Markdown, it is necessary not to forget that special characters should be escaped, and control characters in the text should be replaced with appropriate text substitutions. This is done quite simply by adding a backslash \ before the special character or using the Calculator function.

txt = tg_escape(s), где s - source text string

To assign a multi-line text value to a variable, specify it as follows:

your_variable = "First line text" + "\n" + "Second line text" + "\n" +"Third line text"

The output in the txt file is a line with slashes already inserted in the appropriate places.

Example:

Escaping example
How Telegram text looks like

Next, mark up the desired text.

An example with a long text:

To do this, you need to use the calculator:

Step 1. Paste the text into the message field:

Step 2. Enable the Markdown markup button:

After enabling the markup button, special characters are escaped.

Step 3. We arrange special characters for formatting the message in the text:

If, after sending the message, it did not reach the messenger, and you see an error in the dialog in the Clients section, it means that you escaped the characters incorrectly..

At the same time, you will see an error when sending a message in the "Clients" section, it will contain a character that has not been escaped.

Error messages that you can see:

  1. There is no closing character:

  1. Character escaping is missing:

HTML markup

To make the HTML markup work, don't forget to click on the HTML button under the text field for the message:

  1. <a href="https://google.com">ссылка</a> -embeds a link into a single word.

Filling example:

  1. <u>underlined</u> - underlined font

Example:

  1. <ins>underlined</ins> - underlined font

Example:

  1. <em>italic</em> - italic font

Example:

  1. <i>italic</i> - italic font

Example:

<strong>strong</strong> - bold font

<strike>strike</strike> - strikethrough text

<span class="tg-spoiler">hidden</span> - hidden text

Example:

<code>Prerfomatted</code> - formatted text

Example:

<pre>Preformatted</pre> - formatted font

Example:

How to enable protected mode for content

To protect content from being shared, you can enable protected mode for messages. To do this, go to the “Message” section and turn on “Protect content":

Protected messages cannot be forwarded, and you cannot take a screenshot on your phone.

Last updated