JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14709
  • Score
    100M100P100Q143654F
  • License MIT

Convert markdown into Telegram-specific markdown

Package Exports

  • telegramify-markdown
  • telegramify-markdown/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (telegramify-markdown) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Telegramify-Markdown

Build codecov License

Telegramify-Markdown is a Markdown to Telegram-specific-markdown converter, based on Unified and Remark.

Install

npm install telegramify-markdown

Usage

const telegramifyMarkdown = require('telegramify-markdown');
const markdown = `
# Header
## Subheader

[1.0.0](http://version.com)

* item 1
* item 2
* item 3

And simple text with + some - symbols.
`;

telegramifyMarkdown(markdown);
/*
 *Header*
 *Subheader*
 
[1\.0\.0](http://version.com)

 • item 1
 • item 2
 • item 3

And simple text with \+ some \- symbols\.
*/

Possible options

You can also add unsupported tags strategy as a second argument, which can be one of the following:

  • escape - escape unsupported symbols for unsupported tags
  • remove - remove unsupported tags
  • keep - ignore unsupported tags (default)
const telegramifyMarkdown = require('telegramify-markdown');
const markdown = `
# Header

> Blockquote

<div>Text in div</div>
`;

telegramifyMarkdown(markdown, 'escape');
/*
*Header*

\> Blockquote

<div\>Text in div</div\>
*/

telegramifyMarkdown(markdown, 'remove');
/*
*Header*
 */

MIT Licence