Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@discordjs/formatters
Advanced tools
A set of functions to format strings for Discord.
@discordjs/formatters is a utility package designed to help format messages and other content for Discord bots. It provides a set of functions to easily format text in a way that is compatible with Discord's markdown and other formatting features.
Code Block Formatting
This feature allows you to format text as a code block in Discord. The `codeBlock` function takes two arguments: the language for syntax highlighting and the code itself.
const { codeBlock } = require('@discordjs/formatters');
const formattedCode = codeBlock('js', 'const x = 10;');
console.log(formattedCode);
Inline Code Formatting
This feature allows you to format text as inline code in Discord. The `inlineCode` function takes a single argument: the code to be formatted.
const { inlineCode } = require('@discordjs/formatters');
const formattedInlineCode = inlineCode('const x = 10;');
console.log(formattedInlineCode);
Quote Formatting
This feature allows you to format text as a quote in Discord. The `quote` function takes a single argument: the text to be quoted.
const { quote } = require('@discordjs/formatters');
const formattedQuote = quote('This is a quoted text.');
console.log(formattedQuote);
Bold Text Formatting
This feature allows you to format text as bold in Discord. The `bold` function takes a single argument: the text to be formatted in bold.
const { bold } = require('@discordjs/formatters');
const formattedBoldText = bold('This is bold text.');
console.log(formattedBoldText);
Italic Text Formatting
This feature allows you to format text as italic in Discord. The `italic` function takes a single argument: the text to be formatted in italic.
const { italic } = require('@discordjs/formatters');
const formattedItalicText = italic('This is italic text.');
console.log(formattedItalicText);
discord.js is a powerful library for interacting with the Discord API. While it is more comprehensive and includes features for creating and managing bots, it also includes some basic formatting utilities. However, it is not as specialized in formatting as @discordjs/formatters.
discord-markdown is a package that parses and renders Discord-flavored markdown. It is useful for converting markdown to HTML or other formats, but it does not provide the same level of utility functions for formatting text directly as @discordjs/formatters.
markdown-it is a markdown parser that can be extended with plugins to support various markdown features, including those used by Discord. While it is highly customizable and powerful, it is not specifically tailored for Discord's formatting needs like @discordjs/formatters.
@discordjs/formatters
set of functions to format strings for Discord.
Node.js 16.9.0 or newer is required.
npm install @discordjs/formatters
yarn add @discordjs/formatters
pnpm add @discordjs/formatters
import { codeBlock } from '@discordjs/formatters';
const formattedCode = codeBlock('hello world!');
console.log(formattedCode);
// Prints:
// ```
// hello world!
// ```
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
documentation.
See the contribution guide if you'd like to submit a PR.
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to join our official discord.js Server.
FAQs
A set of functions to format strings for Discord.
The npm package @discordjs/formatters receives a total of 146,057 weekly downloads. As such, @discordjs/formatters popularity was classified as popular.
We found that @discordjs/formatters demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.