🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

telegram-bot-markdown

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

telegram-bot-markdown

đź’¬ Markdown helpers for Telegram Bot

latest
Source
npmnpm
Version
1.0.4
Version published
Maintainers
1
Created
Source

đź’¬ Markdown helpers for Telegram Bot

  • đź’¬ Markdown helpers for Telegram Bot

Installation

npm i telegram-bot-markdown

Features

Escape markdown

When you send a message in markdown format, you must escape special characters. This package will help you do that.

import { escapeMarkdown } from 'telegram-bot-markdown'

const markdownMessage = `Hello, *world*! ${escapeMarkdown('(text with special characters!)')}`

Generate markdown by template

A special template for generating messages in markdown format. Allows you to keep all messages in the same form using a strict template. Useful for DX and UI/UX.

import { generateMarkdown } from 'telegram-bot-markdown'

const markdownMessage = generateMarkdown({
  title: 'Title',
  description: 'Description',
  items: [
    {
      type: 'STRING',
      data: 'String item',
    },
    {
      type: 'LINEBREAK',
    },
    {
      type: 'KEY_VALUE',
      data: {
        key: 'Key',
        value: 'Value',
      },
    },
    {
      type: 'KEY_VALUE',
      data: {
        key: 'Key 2',
        value: 'Value 2',
        valueType: 'code',
      },
    },
    {
      type: 'LINEBREAK',
    },
    {
      type: 'CODE_BLOCK',
      data: {
        lang: 'json',
        code: JSON.stringify({ code: 'block' }, null, 2),
      },
    },
  ],
})

Keywords

telegram

FAQs

Package last updated on 21 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts