2.0.1 • Published 10 months ago

@telegram.ts/formatters v2.0.1

Weekly downloads
-
License
-
Repository
-
Last release
10 months ago

@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.

1.2.0

1 year ago

2.0.1

10 months ago

1.3.0

10 months ago

2.0.0

11 months ago

1.1.0

1 year ago

1.0.0

1 year ago

0.4.1

2 years ago

0.3.5

2 years ago

0.3.0

2 years ago

0.2.9

2 years ago