Skip to content

About

Convert CommonMark, GFM, and common Markdown extensions to Telegram Rich Markdown.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

8 Commits

Folders and files

Repository files navigation

Telegram Rich Markdown

Convert CommonMark, GFM, and common Markdown extensions to Telegram Rich Markdown.

See the feature matrix.

How it works

The converter preserves the original Markdown and changes only what is necessary.

  1. The parser reads the input as CommonMark/GFM with math support and builds an AST.
  2. The converter uses the AST to identify editable text and structural nodes while leaving protected content unchanged.
  3. The converter rewrites supported Markdown extensions into Telegram Rich Markdown. Additional transformations can be added through RichMarkdownExtension.

This AST-based, source-preserving approach keeps existing Markdown intact, avoids rewriting protected content, and makes the converter easy to extend.

Benchmark

Run bun run bench. Each sample is warmed up for 100 iterations and measured for 1,000 iterations:

Sample Input Average Throughput Operations
GFM + Extensions 5,406 B 2.400 ms/op 2.15 MiB/s 416.58 op/s
Telegram Rich Markdown 3,154 B 2.317 ms/op 1.30 MiB/s 431.52 op/s

These are local Bun results and are intended only for relative comparisons in the same environment.

About

Convert CommonMark, GFM, and common Markdown extensions to Telegram Rich Markdown.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages