mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
* feat: add new markdown formatters Co-authored-by: Jaw0r3k <jaw0r3k.g@gmail.com> * Update packages/formatters/src/formatters.ts Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> * refactor: remove unnecessary index tracking and rename 'array' to 'items' Co-authored-by: Almeida <almeidx@pm.me> * refactor: rename 'array' to 'items' Co-authored-by: Almeida <almeidx@pm.me> * refactor(heading): consolidate heading functions into a single function Also correct param names from array to items. Co-authored-by: Jaw0r3k <jaw0r3k.g@gmail.com> * refactor: add HeadingLevel enum and use switch case * fix: export HeadingLevel enum Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com> * feat(heading): add missing documentation for level parameter * refactor: update list formatters * docs: correct heading formatter description * refactor: update list formatters * fix(heading): remove unnecessary space * refactor: move list callback function to outer scope * test: add tests * refactor: requested changes * refactor: suggested changes * docs: add missing documentation * style: suggested change Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> * refactor: use math max method instead Co-authored-by: Almeida <almeidx@pm.me> --------- Co-authored-by: Jaw0r3k <jaw0r3k.g@gmail.com> Co-authored-by: Sugden <28943913+NotSugden@users.noreply.github.com> Co-authored-by: Almeida <almeidx@pm.me> Co-authored-by: Jaw0r3k <jaworekwiadomosci@gmail.com> Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: space <spaceeec@yahoo.com>
About
@discordjs/formatters is a collection of functions for formatting strings to be used on Discord.
Installation
Node.js 16.11.0 or newer is required.
npm install @discordjs/formatters
yarn add @discordjs/formatters
pnpm add @discordjs/formatters
Example usage
import { codeBlock } from '@discordjs/formatters';
const formattedCode = codeBlock('hello world!');
console.log(formattedCode);
// Prints:
// ```
// hello world!
// ```
Links
- Website (source)
- Documentation
- Guide (source) Also see the v13 to v14 Update Guide, which includes updated and removed items from the library.
- discord.js Discord server
- Discord API Discord server
- GitHub
- npm
- Related libraries
Contributing
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.
Help
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.