Description
n8n-nodes-telegram-better-markdown
This is an n8n community node that converts Markdown text to Telegram-compatible HTML format for use with the Telegram Bot API.
The node allows you to take regular Markdown text (including output from LLMs) and convert it to properly formatted HTML that displays beautifully in Telegram messages. It supports standard Markdown syntax plus Telegram-specific features like spoilers, user mentions, custom emojis, and expandable blockquotes.
n8n is a fair-code licensed workflow automation platform.
- Installation
- Features
- Usage
- Supported Markdown Features
- Telegram-Specific Features
- Examples
- Compatibility
- Resources
Installation
Follow the installation guide in the n8n community nodes documentation.
Alternatively, install directly via npm:
npm install n8n-nodes-telegram-better-markdown
Features
- ✅ Converts standard Markdown to Telegram HTML format
- ✅ Supports all Telegram formatting tags (bold, italic, strikethrough, code, links, etc.)
- ✅ Handles Telegram-specific features:
- Spoilers (
||text||) - User mentions (
[name](tg://user?id=123456789)) - Custom emojis (
) - Expandable blockquotes (automatic or manual)
- Spoilers (
- ✅ Properly escapes HTML special characters
- ✅ Handles nested lists with proper indentation
- ✅ Code blocks with language syntax highlighting
- ✅ Perfect for processing LLM output for Telegram bots
Usage
- Add the Telegram Markdown node to your n8n workflow
- Connect it to a node that provides text data (e.g., OpenAI, HTTP Request, or any data source)
- Configure the node:
- Markdown Text: The markdown content to convert (can use expressions to reference data from previous nodes)
- Output Field: The name of the field where the converted HTML will be stored (default:
telegramHtml)
- Connect the output to a Telegram node or any other node that needs the formatted HTML
Example Workflow
LLM Node → Telegram Markdown → Telegram Bot (sendMessage)
In the Telegram node, set:
- Text:
{{ $json.telegramHtml }} - Parse Mode:
HTML
Supported Markdown Features
| Markdown | Output | Telegram Tag |
|---|---|---|
**bold** or __bold__ |
bold | <b> |
*italic* or _italic_ |
italic | <i> |
~~strikethrough~~ |
<s> |
|
`code` |
code |
<code> |
```code block``` |
code block | <pre><code> |
[link](url) |
link | <a href=""> |
# Heading |
Heading | <b> |
> quote |
quote | <blockquote> |
- list item |
• list item | Formatted list |
1. item |
1. item | Formatted list |
--- |
—— | Horizontal rule |
Telegram-Specific Features
Spoilers
Use double pipes to create spoiler text:
This is ||hidden text|| that can be revealed
User Mentions
Link to Telegram users using their user ID:
Hello [John](tg://user?id=123456789)!
Custom Emojis
Reference custom emojis by their emoji ID:
Great work! 
Expandable Blockquotes
Blockquotes automatically become expandable if they:
- Are longer than 320 characters, OR
- Have more than 4 lines
You can also explicitly mark a blockquote as expandable by ending it with ||:
> This is a long quote that will be expandable.
> It contains important information.
> Users can tap to expand it.||
Nested Lists
The node properly handles nested lists with automatic indentation:
- Parent item
- Nested item
- Deeper nested item
- Another parent
Examples
Basic Formatting
Input:
# Welcome to My Bot
This is **bold** and this is *italic*.
Check out this [link](https://example.com).
Output:
<b>Welcome to My Bot</b>
This is <b>bold</b> and this is <i>italic</i>.
Check out this <a href="https://example.com">link</a>.
Code Blocks
Input:
Here's some code:
```javascript
function hello() {
console.log("Hello, world!");
}
```
Output:
Here's some code:
<pre><code class="language-javascript">function hello() {
console.log("Hello, world!");
}</code></pre>
LLM Integration Example
When using with an LLM like ChatGPT:
- OpenAI Node → outputs markdown response
- Telegram Markdown Node → converts to HTML
- Telegram Node → sends formatted message
This allows your bot to display beautifully formatted messages with all the markdown features that LLMs naturally generate.
Compatibility
- Minimum n8n version: 0.200.0
- Tested on: n8n 1.0.0+
- Telegram Bot API: Compatible with all current versions
Resources
- n8n community nodes documentation
- Telegram Bot API – Formatting options
- Telegram Bot API – HTML style
Version History
0.1.0 (Initial Release)
- Full Markdown to Telegram HTML conversion
- Support for all Telegram formatting tags
- Spoiler syntax support
- User mentions and custom emojis
- Expandable blockquotes (automatic and manual)
- Nested list handling with proper indentation
- Code blocks with syntax highlighting support