🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@telegram.ts/formatters

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@telegram.ts/formatters

Sub-library for formatting Telegram messages

latest
npmnpm
Version
2.0.1
Version published
Maintainers
1
Created
Source

@telegram.ts/formatters

NPM Version Bot API NPM Downloads

@telegram.ts/formatters is a TypeScript library that provides functions for formatting messages according to the Telegram API's formatting rules. It offers a set of functions for applying various text formatting styles.

Features

  • Text Formatting: Apply bold, italic, underline, strikethrough, and spoiler formatting to text.
  • Inline URLs and Mentions: Create clickable inline URLs and user mentions within messages.
  • Emoji Support: Embed emojis into messages for expressive communication.
  • Code Blocks: Format text as inline or pre-formatted code blocks with syntax highlighting support.

Installation

You can install @telegram.ts/formatters via npm or yarn:

npm install @telegram.ts/formatters
# or
yarn add @telegram.ts/formatters

Usage

import {
    html: {
    bold,
    italic,
    underline,
    strikethrough,
    spoiler,
    inlineURL,
    inlineMention,
    inlineEmoji,
    inlineCode,
    codeBlock,
    },
    parseEntities,
} from '@telegram.ts/formatters';

// Apply text formatting
const formattedText = bold('bold text') + '\n' +
    italic('italic text') + '\n' +
    underline('underline') + '\n' +
    strikethrough('strikethrough') + '\n' +
    spoiler('spoiler');

console.log(formattedText, parseEntities(formattedText, "HTML"));

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please create a GitHub issue or submit a pull request. Additionally, feel free to reach out to me on Telegram via my username @SempaiJS or on Discord using my username sempaika_chess.

Keywords

javascript

FAQs

Package last updated on 14 Sep 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