{"_id":"telegram-markdown-v2","_rev":"5-a05d56c1fd4b6952e14e6c8855a78133","name":"telegram-markdown-v2","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1":{"name":"telegram-markdown-v2","version":"0.0.1","keywords":["telegram","markdown","markdown-processor","parser","markdown-v2","typescript","remark","unified"],"author":{"name":"Claude Code"},"license":"MIT","_id":"telegram-markdown-v2@0.0.1","maintainers":[{"name":"andyrightnow","email":"naruto199507@gmail.com"}],"homepage":"https://github.com/your-username/telegram-markdown-v2#readme","bugs":{"url":"https://github.com/your-username/telegram-markdown-v2/issues"},"dist":{"shasum":"cf23b001db95f40be868440374319a4793dc579e","tarball":"https://registry.npmjs.org/telegram-markdown-v2/-/telegram-markdown-v2-0.0.1.tgz","fileCount":46,"integrity":"sha512-iUfa4hs5MGzR3INfJJQo0sCpeHyHSzzOSNglJ94DpnuDquWoWe7Xu2n2YG12qyag/RgBSn7BMKKl9H9UIfjG4A==","signatures":[{"sig":"MEUCIGVqAsTwyJfI6z789Xz6rlalPOT2qgP603T6sTJPpSiwAiEAqtUBAObrTKCq4AcR56Ua7PfWxB2JOU//5kQHyvZgDOI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":46454},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=16.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","lint":"eslint src tests --fix","test":"bun test","build":"tsc","clean":"rm -rf dist","format":"prettier --write .","prepack":"bun run build","typecheck":"tsc --noEmit","prepublishOnly":"bun run clean && bun run build && bun run test"},"_npmUser":{"name":"andyrightnow","email":"naruto199507@gmail.com"},"repository":{"url":"git+https://github.com/your-username/telegram-markdown-v2.git","type":"git"},"_npmVersion":"10.9.2","description":"Convert markdown into Telegram Markdown V2 format with TypeScript support","directories":{},"_nodeVersion":"22.17.1","dependencies":{"remark":"^15.0.1","unified":"^11.0.5","remark-gfm":"^4.0.1","@types/mdast":"^4.0.4","remark-parse":"^11.0.0","remark-stringify":"^11.0.0","unist-util-visit":"^5.0.0","unist-util-remove":"^4.0.0","mdast-util-phrasing":"^4.1.0","mdast-util-gfm-table":"^2.0.0","mdast-util-to-string":"^4.0.0","mdast-util-to-markdown":"^2.1.2","remark-remove-comments":"^1.1.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.35.0","@eslint/js":"^9.35.0","@types/bun":"latest","typescript":"^5.9.2","typescript-eslint":"^8.43.0","prettier-plugin-organize-imports":"^4.2.0"},"_npmOperationalInternal":{"tmp":"tmp/telegram-markdown-v2_0.0.1_1757597080584_0.9418128268991195","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"telegram-markdown-v2","version":"0.0.2","keywords":["telegram","markdown","markdown-processor","parser","markdown-v2","typescript","remark","unified"],"author":{"name":"Claude Code"},"license":"MIT","_id":"telegram-markdown-v2@0.0.2","maintainers":[{"name":"andyrightnow","email":"naruto199507@gmail.com"}],"homepage":"https://github.com/andyrightnow/telegram-markdown-v2#readme","bugs":{"url":"https://github.com/andyrightnow/telegram-markdown-v2/issues"},"dist":{"shasum":"7dd8c24331be09db5202fe1a9794cd8b95b82000","tarball":"https://registry.npmjs.org/telegram-markdown-v2/-/telegram-markdown-v2-0.0.2.tgz","fileCount":24,"integrity":"sha512-bv0IZmckF92fs0zhasfcVLOc2p+YgSHL5tdU2LnmShPRERmuSTLIlkeq0WjTiaNolKm7DsiRqUe5D0koZohvzw==","signatures":[{"sig":"MEYCIQCLn0RcJy0kdZDOjyIMze5CL1AzZT2izxqOPvjU5didlgIhAI8jxXZG5LASDB4ItDYr7TGhsiPW5nA7a46h82DWUt1p","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32156},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"bun":">=1.2.20","node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"b16894fa3acadbec3ad3bea5a3723fad8fbc9cd8","scripts":{"dev":"tsc --watch","lint":"eslint src tests --fix","test":"bun test","build":"tsc","clean":"rm -rf dist","format":"prettier --write .","prepack":"bun run build","typecheck":"tsc --noEmit","prepublishOnly":"bun run clean && bun run build && bun run test"},"_npmUser":{"name":"andyrightnow","email":"naruto199507@gmail.com"},"repository":{"url":"git+https://github.com/andyrightnow/telegram-markdown-v2.git","type":"git"},"_npmVersion":"10.9.2","description":"Convert markdown into Telegram Markdown V2 format with TypeScript support","directories":{},"_nodeVersion":"22.17.1","dependencies":{"remark":"^15.0.1","unified":"^11.0.5","remark-gfm":"^4.0.1","@types/mdast":"^4.0.4","remark-parse":"^11.0.0","remark-stringify":"^11.0.0","unist-util-visit":"^5.0.0","unist-util-remove":"^4.0.0","mdast-util-phrasing":"^4.1.0","mdast-util-gfm-table":"^2.0.0","mdast-util-to-string":"^4.0.0","mdast-util-to-markdown":"^2.1.2","remark-remove-comments":"^1.1.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.35.0","@eslint/js":"^9.35.0","@types/bun":"latest","typescript":"^5.9.2","typescript-eslint":"^8.43.0","prettier-plugin-organize-imports":"^4.2.0"},"_npmOperationalInternal":{"tmp":"tmp/telegram-markdown-v2_0.0.2_1757614834027_0.09504669171758895","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"telegram-markdown-v2","version":"0.0.3","keywords":["telegram","markdown","markdown-processor","parser","markdown-v2","typescript","remark","unified"],"author":{"name":"Claude Code"},"license":"MIT","_id":"telegram-markdown-v2@0.0.3","maintainers":[{"name":"andyrightnow","email":"naruto199507@gmail.com"}],"homepage":"https://github.com/andyrightnow/telegram-markdown-v2#readme","bugs":{"url":"https://github.com/andyrightnow/telegram-markdown-v2/issues"},"dist":{"shasum":"f2af8f77f5d83545b84a8e9e7bc3ed1dfc70fedb","tarball":"https://registry.npmjs.org/telegram-markdown-v2/-/telegram-markdown-v2-0.0.3.tgz","fileCount":24,"integrity":"sha512-fdec1AqVvT5QkPYoCkO1v1dJCkckfliDSaIIqdeuogVJapzVOSd5KoOi5nY5D3h1Pjh4zyqUHSWHflMvFvsXYA==","signatures":[{"sig":"MEQCIEAJpRdTMiWQu2L1DDq14OTXrGLpVrt3BWUAKtctmd6YAiA9Q12eGfVpSAXri9Rrvp+o4moXT+iv7Zl1LB7BfwQDRw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32189},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"bun":">=1.2.20","node":">=18.0.0"},"exports":{".":{"main":"./dist/index.js","types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"54e93826993d6b2d5c278316899bf6c86d964ad8","scripts":{"dev":"tsc --watch","lint":"eslint src tests --fix","test":"bun test","build":"tsc","clean":"rm -rf dist","format":"prettier --write .","prepack":"bun run build","typecheck":"tsc --noEmit","prepublishOnly":"bun run clean && bun run build && bun run test"},"_npmUser":{"name":"andyrightnow","email":"naruto199507@gmail.com"},"repository":{"url":"git+https://github.com/andyrightnow/telegram-markdown-v2.git","type":"git"},"_npmVersion":"10.9.2","description":"Convert markdown into Telegram Markdown V2 format with TypeScript support","directories":{},"_nodeVersion":"22.17.1","dependencies":{"remark":"^15.0.1","unified":"^11.0.5","remark-gfm":"^4.0.1","@types/mdast":"^4.0.4","remark-parse":"^11.0.0","remark-stringify":"^11.0.0","unist-util-visit":"^5.0.0","unist-util-remove":"^4.0.0","mdast-util-phrasing":"^4.1.0","mdast-util-gfm-table":"^2.0.0","mdast-util-to-string":"^4.0.0","mdast-util-to-markdown":"^2.1.2","remark-remove-comments":"^1.1.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.35.0","@eslint/js":"^9.35.0","@types/bun":"latest","typescript":"^5.9.2","typescript-eslint":"^8.43.0","prettier-plugin-organize-imports":"^4.2.0"},"_npmOperationalInternal":{"tmp":"tmp/telegram-markdown-v2_0.0.3_1757615249564_0.33953877354736073","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"telegram-markdown-v2","version":"0.0.4","keywords":["telegram","markdown","markdown-processor","parser","markdown-v2","typescript","remark","unified"],"author":{"name":"Claude Code"},"license":"MIT","_id":"telegram-markdown-v2@0.0.4","maintainers":[{"name":"andyrightnow","email":"naruto199507@gmail.com"}],"homepage":"https://github.com/andyrightnow/telegram-markdown-v2#readme","bugs":{"url":"https://github.com/andyrightnow/telegram-markdown-v2/issues"},"dist":{"shasum":"bcfebf68e88185753bb0ed421499d02fe71ce01e","tarball":"https://registry.npmjs.org/telegram-markdown-v2/-/telegram-markdown-v2-0.0.4.tgz","fileCount":24,"integrity":"sha512-AUDmxX1eHk+u5qTWtCCuvznF3y/1TlXcGnJDzF8WA3sqi1gPaNbHmWRLLYyra04I5ALu1A4wPLi8hed5AHpigw==","signatures":[{"sig":"MEYCIQC/jIUA/d07iE+czWgDYsUlWnzGh/FcHJwiGMAE1x6uPAIhAOmkXBQ3FNGtyz5zJ9rD6asKMDLJzNOrd6iVGhw63GDD","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32081},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"bun":">=1.2.20","node":">=18.0.0"},"exports":"./dist/index.js","gitHead":"54e93826993d6b2d5c278316899bf6c86d964ad8","scripts":{"dev":"tsc --watch","lint":"eslint src tests --fix","test":"bun test","build":"tsc","clean":"rm -rf dist","format":"prettier --write .","prepack":"bun run build","typecheck":"tsc --noEmit","prepublishOnly":"bun run clean && bun run build && bun run test"},"_npmUser":{"name":"andyrightnow","email":"naruto199507@gmail.com"},"repository":{"url":"git+https://github.com/andyrightnow/telegram-markdown-v2.git","type":"git"},"_npmVersion":"10.9.2","description":"Convert markdown into Telegram Markdown V2 format with TypeScript support","directories":{},"_nodeVersion":"22.17.1","dependencies":{"remark":"^15.0.1","unified":"^11.0.5","remark-gfm":"^4.0.1","@types/mdast":"^4.0.4","remark-parse":"^11.0.0","remark-stringify":"^11.0.0","unist-util-visit":"^5.0.0","unist-util-remove":"^4.0.0","mdast-util-phrasing":"^4.1.0","mdast-util-gfm-table":"^2.0.0","mdast-util-to-string":"^4.0.0","mdast-util-to-markdown":"^2.1.2","remark-remove-comments":"^1.1.1"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.35.0","@eslint/js":"^9.35.0","@types/bun":"latest","typescript":"^5.9.2","typescript-eslint":"^8.43.0","prettier-plugin-organize-imports":"^4.2.0"},"_npmOperationalInternal":{"tmp":"tmp/telegram-markdown-v2_0.0.4_1757615845100_0.7718513527604611","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"telegram-markdown-v2","version":"0.0.5","description":"Convert markdown into Telegram Markdown V2 format with TypeScript support","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":"./dist/index.js","scripts":{"build":"tsc","clean":"rm -rf dist","format":"prettier --write .","dev":"tsc --watch","test":"bun test","lint":"eslint src tests --fix","typecheck":"tsc --noEmit","prepublishOnly":"bun run clean && bun run build && bun run test","prepack":"bun run build"},"keywords":["telegram","markdown","markdown-processor","parser","markdown-v2","typescript","remark","unified"],"author":{"name":"Claude Code"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/andyrightnow/telegram-markdown-v2.git"},"bugs":{"url":"https://github.com/andyrightnow/telegram-markdown-v2/issues"},"homepage":"https://github.com/andyrightnow/telegram-markdown-v2#readme","engines":{"node":">=18.0.0","bun":">=1.2.20"},"devDependencies":{"@eslint/js":"^9.35.0","@types/bun":"latest","eslint":"^9.35.0","prettier-plugin-organize-imports":"^4.2.0","typescript":"^5.9.2","typescript-eslint":"^8.43.0"},"dependencies":{"@types/mdast":"^4.0.4","mdast-util-gfm-table":"^2.0.0","mdast-util-phrasing":"^4.1.0","mdast-util-to-markdown":"^2.1.2","mdast-util-to-string":"^4.0.0","remark":"^15.0.1","remark-gfm":"^4.0.1","remark-parse":"^11.0.0","remark-remove-comments":"^1.1.1","remark-stringify":"^11.0.0","unified":"^11.0.5","unist-util-remove":"^4.0.0","unist-util-visit":"^5.0.0"},"gitHead":"3531d365fc652b6dc3a6623a4e8dc797250dda28","_id":"telegram-markdown-v2@0.0.5","_nodeVersion":"22.17.1","_npmVersion":"11.7.0","dist":{"integrity":"sha512-8uJ0COzdAWhODffP/XWCOxORCcVDtEZyc8a+NUZtr/vcHMpLFeriUaBpa3gM6wUxH6K358SsB7UK+z2jd7W+Zg==","shasum":"e7b49e00a902dd03e60658b8f87cdea218152c9e","tarball":"https://registry.npmjs.org/telegram-markdown-v2/-/telegram-markdown-v2-0.0.5.tgz","fileCount":24,"unpackedSize":32687,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDJRIRYtk//KwnPw0nx0Wn7uy5FG3cVzCExyRXIgPnWwwIgQrGUki01yH+/tGSSBA5IenWU+PTOfrENpokceN6ags4="}]},"_npmUser":{"name":"andyrightnow","email":"naruto199507@gmail.com"},"directories":{},"maintainers":[{"name":"andyrightnow","email":"naruto199507@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/telegram-markdown-v2_0.0.5_1781710934983_0.41122362988327454"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-11T13:24:40.583Z","modified":"2026-06-17T15:42:15.292Z","0.0.1":"2025-09-11T13:24:40.778Z","0.0.2":"2025-09-11T18:20:34.276Z","0.0.3":"2025-09-11T18:27:29.764Z","0.0.4":"2025-09-11T18:37:25.348Z","0.0.5":"2026-06-17T15:42:15.110Z"},"bugs":{"url":"https://github.com/andyrightnow/telegram-markdown-v2/issues"},"author":{"name":"Claude Code"},"license":"MIT","homepage":"https://github.com/andyrightnow/telegram-markdown-v2#readme","keywords":["telegram","markdown","markdown-processor","parser","markdown-v2","typescript","remark","unified"],"repository":{"type":"git","url":"git+https://github.com/andyrightnow/telegram-markdown-v2.git"},"description":"Convert markdown into Telegram Markdown V2 format with TypeScript support","maintainers":[{"name":"andyrightnow","email":"naruto199507@gmail.com"}],"readme":"# telegram-markdown-v2\n\nA lightweight TypeScript library for seamlessly transforming standard Markdown into Telegram's MarkdownV2 format. Built for developers who want reliable Markdown-to-Telegram conversion without the hassle.\n\n## Why This Library?\n\nWorking with Telegram's MarkdownV2 format can be frustrating - special characters need escaping, formatting rules are strict, and one wrong character breaks everything. This library handles all the complexity, letting you focus on your bot's functionality.\n\n## Installation\n\n```bash\nbun install telegram-markdown-v2\n```\n\nOr with npm:\n```bash\nnpm install telegram-markdown-v2\n```\n\n## Quick Start\n\n```typescript\nimport { convert } from 'telegram-markdown-v2';\n\nconst markdown = `\n# Hello World\nThis is **bold text** and *italic text*.\n- List item 1\n- List item 2\n`;\n\nconst telegramMarkdown = convert(markdown);\nconsole.log(telegramMarkdown);\n```\n\n## API Reference\n\n### `convert(markdown: string, unsupportedTagsStrategy?: UnsupportedTagsStrategy): string`\n\nTransforms standard Markdown into Telegram MarkdownV2 format.\n\n**Parameters:**\n- `markdown`: The input Markdown string\n- `unsupportedTagsStrategy`: Optional strategy for handling unsupported tags (`'keep'` | `'escape'` | `'remove'`). Default: `'keep'`\n\n**Returns:** Formatted string ready for Telegram's `parse_mode: 'MarkdownV2'`\n\n## Supported Markdown Elements\n\n| Element | Input | Telegram Output |\n|---------|-------|----------------|\n| **Bold** | `**text**` | `*text*` |\n| *Italic* | `*text*` | `_text_` |\n| __Underline__ | `<u>text</u>` | `__text__` |\n| ~~Strikethrough~~ | `~~text~~` | `~text~` |\n| Spoiler | `<span class=\"tg-spoiler\">text</span>` | `||text||` |\n| `Inline Code` | `` `code` `` | `` `code` `` |\n| [Links](url) | `[text](url)` | `[text](url)` |\n| Block Quotes | `> quote` | Configurable (keep/escape/remove) |\n| Code Blocks | ``` ```lang code``` ``` | ``` ```code``` ``` |\n| Lists | `- item` | `• item` |\n| Headings | `# Title` | `*Title*` |\n\n## Configuration Options\n\n```typescript\ntype UnsupportedTagsStrategy = 'escape' | 'remove' | 'keep';\n```\n\n**Strategy Options:**\n- `'keep'` (default): Preserve unsupported elements as-is\n- `'escape'`: Escape special characters in unsupported elements  \n- `'remove'`: Remove unsupported elements entirely\n\n## Examples\n\n### Basic Formatting\n```typescript\nimport { convert } from 'telegram-markdown-v2';\n\nconst input = \"Check out this **amazing** library with *great* features!\";\nconst output = convert(input);\n// Result: \"Check out this *amazing* library with _great_ features\\\\!\"\n```\n\n### Code Blocks\n```typescript\nconst codeExample = `\nHere's some JavaScript code:\n\\`\\`\\`javascript\nfunction hello() {\n  console.log(\"Hello, world!\");\n}\n\\`\\`\\`\n`;\n\nconst formatted = convert(codeExample);\n// Ready to send via Telegram Bot API\n```\n\n### Lists and Links\n```typescript\nconst listExample = `\n## Todo List\n- Create awesome library\n- Write documentation  \n- Publish to npm\n\nVisit [our repo](https://github.com/example/telegram-markdown-v2)\n`;\n\nconst telegramReady = convert(listExample);\n```\n\n## Advanced Usage\n\n### Unsupported Tags Strategy\n```typescript\nimport { convert } from 'telegram-markdown-v2';\n\n// Keep unsupported tags as-is (default)\nconst keepResult = convert('> This is a blockquote', 'keep');\n// Result: \"> This is a blockquote\\n\"\n\n// Escape special characters in unsupported tags\nconst escapeResult = convert('> This is a blockquote', 'escape');\n// Result: \"\\\\> This is a blockquote\\n\"\n\n// Remove unsupported tags entirely\nconst removeResult = convert('> This is a blockquote', 'remove');\n// Result: \"\"\n```\n\n### Telegram V2 Specific Features\n```typescript\n// Underline support\nconst underline = convert('This is <u>underlined</u> text');\n// Result: \"This is __underlined__ text\\n\"\n\n// Spoiler support\nconst spoiler = convert('This is <span class=\"tg-spoiler\">hidden</span> text');\n// Result: \"This is ||hidden|| text\\n\"\n\n// Custom emoji and user mentions\nconst mentions = convert('[John](tg://user?id=123) sent ![👍](tg://emoji?id=456)');\n// Result: \"[John](tg://user\\\\?id\\\\=123) sent [👍](tg://emoji\\\\?id\\\\=456)\\n\"\n```\n\n## Common Issues & Solutions\n\n### Special Characters\nThe library automatically escapes Telegram's special characters: `_*[]()~`#+-=|{}.!`\n\n### Message Length\nTelegram limits messages to 4096 characters. You'll need to implement message splitting in your application.\n\n### Formatting Conflicts\nIf your Markdown doesn't render correctly, check for unmatched formatting marks or nested styles.\n\n### Unsupported Elements\nElements like tables, blockquotes, and HTML tags can be handled using the `unsupportedTagsStrategy` parameter.\n\n## Development\n\n```bash\n# Install dependencies\nbun install\n\n# Run tests\nbun test\n\n# Build for production\nbun run build\n\n# Type checking\nbun run typecheck\n\n# Linting\nbun run lint\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nMIT © 2025\n\n## Acknowledgments\n\nInspired by the Python `telegramify-markdown` library, reimagined for the TypeScript ecosystem with modern tooling and better performance.\n","readmeFilename":"README.md"}