Overview
This node converts standard Markdown text into Telegram's MarkdownV2 format, escapes plain text for safe usage in Telegram MarkdownV2, or validates if a given text is properly formatted for Telegram MarkdownV2. It is useful when you want to prepare messages with rich formatting that are compatible with Telegram's specific markdown syntax, ensuring correct display and avoiding formatting errors.
Common scenarios include:
- Converting user-generated Markdown content into Telegram-compatible MarkdownV2 before sending messages via Telegram bots.
- Escaping special characters in plain text to prevent unintended formatting in Telegram messages.
- Validating existing Telegram MarkdownV2 text to detect formatting issues before sending.
Practical example:
- You have a blog post written in standard Markdown and want to send a snippet formatted correctly on Telegram. Use the "Convert to Telegram MarkdownV2" operation.
- You want to send a message containing special characters without triggering Telegram formatting. Use the "Escape Text for Telegram" operation.
- You want to check if your Telegram MarkdownV2 message will render correctly. Use the "Validate Telegram MarkdownV2" operation.
Properties
| Name | Meaning |
|---|---|
| Input Text | The markdown text to convert to Telegram MarkdownV2 format or text to escape/validate depending on operation. |
| Conversion Options | Collection of options affecting conversion behavior: |
| - Preserve Line Breaks | Whether to preserve line breaks in the converted text (true/false). |
| - Convert HTML Tags | Whether to convert HTML tags in the input text to Telegram MarkdownV2 equivalents (true/false). |
| - Strict Mode | Whether to use strict mode that fails on unsupported markdown features (true/false). |
| - Auto Escape Special Characters | Whether to automatically escape special characters that could break Telegram formatting (true/false). |
Output
The output JSON structure varies by operation:
Convert to Telegram MarkdownV2:
{ "originalText": "<input text>", "telegramMarkdown": "<converted Telegram MarkdownV2 text>", "operation": "convertToTelegramMd", "processedBy": "TechFlecks Telegram Markdown Parser" }Contains the original input and the converted Telegram MarkdownV2 string.
Escape Text for Telegram:
{ "originalText": "<input text>", "escapedText": "<text with special characters escaped for Telegram>", "operation": "escapeForTelegram", "processedBy": "TechFlecks Telegram Markdown Parser" }Contains the original input and the escaped text safe for Telegram MarkdownV2.
Validate Telegram MarkdownV2:
{ "originalText": "<input text>", "isValid": true|false, "errors": [<list of error messages>], "warnings": [<list of warning messages>], "suggestions": [<list of suggestions>], "operation": "validateTelegramMd", "processedBy": "TechFlecks Telegram Markdown Parser" }Provides validation results including errors, warnings, and suggestions about the Telegram MarkdownV2 formatting.
The node does not output binary data.
Dependencies
- No external services or APIs are required.
- The node relies on internal logic to parse and convert Markdown formats.
- No special environment variables or credentials are needed.
Troubleshooting
Common Issues:
- Input text contains unsupported or nested markdown formatting that Telegram MarkdownV2 does not support well.
- URLs in links do not start with supported schemes (
http://,https://, ortg://), causing potential link issues. - Unescaped special characters cause Telegram formatting errors.
Error Messages:
"Unknown operation: <operation>": Occurs if an invalid operation is selected. Ensure the operation is one of the supported options.- Validation errors such as
"Unmatched bold formatting"or"Unescaped special characters"indicate formatting problems in the input text.
Resolutions:
- Use the "Escape Text for Telegram" operation to automatically escape problematic characters.
- Avoid nesting different markdown styles (e.g., bold inside italic).
- Ensure URLs in links are valid and start with supported protocols.
- Enable "Strict Mode" to fail early on unsupported markdown features.
Links and References
- Telegram MarkdownV2 Formatting
- Markdown Guide
- TechFlecks Telegram Markdown Parser GitHub (if available) (Note: hypothetical link)