This module provides utilities functions for manipulate markdown with discord.
With npm :
npm install discord-markdown.js
With yarn :
yarn add discord-markdown.js
CommonJS syntax :
const {
MarkdownBuild,
MarkdownParser,
MarkdownEscaper,
} = require("discord-markdown.js");
Module ES syntax :
import {
MarkdownBuild,
MarkdownParser,
MarkdownEscaper,
} from "discord-markdown.js";
Return text formatted with bold
Params :
- text : The text to formatted (string)
Return :
The text formatted (string)
console.log(MarkdownBuild.bold("Hello world"));
Return text formatted with italic
Params :
- text : The text to formatted (string)
Return :
The text formatted (string)
console.log(MarkdownBuild.italic("Hello world"));
Return text formatted with underline
Params :
- text : The text to formatted (string)
Return :
The text formatted (string)
console.log(MarkdownBuild.underline("Hello world"));
Return text formatted with strikethrough
Params :
- text : The text to formatted (string)
Return :
The text formatted (string)
console.log(MarkdownBuild.strikethrough("Hello world"));
Return text formatted with code
Params :
- text : The text to formatted (string)
Return :
The text formatted (string)
console.log(MarkdownBuild.code("Hello world"));
Return text formatted with codeBlock
Params :
- text : The text to formatted (string)
Return :
The text formatted (string)
console.log(MarkdownBuild.codeBlock("Hello world"));
Return text formatted with quote
Params :
- text : The text to formatted (string)
Return :
The text formatted (string)
console.log(MarkdownBuild.quote("Hello world"));
Return text formatted with quoteBlock
Params :
- text : The text to formatted (string)
Return :
The text formatted (string)
console.log(MarkdownBuild.quoteBlock("Hello world"));
Return text formatted with codeBlock
Params :
- text : The text to formatted (string)
Return :
The text formatted (string)
console.log(MarkdownBuild.codeBlock("Hello world"));
Return text with bold escaped.
Params :
- text : The text to escaped (string)
Return :
The text escaped (string)
console.log(MarkdownEscaper.bold("Hello world"));
Return text with italic escaped.
Params :
- text : The text to escaped (string)
Return :
The text escaped (string)
console.log(MarkdownEscaper.italic("Hello world"));
Return text with underline escaped.
Params :
- text : The text to escaped (string)
Return :
The text escaped (string)
console.log(MarkdownEscaper.underline("Hello world"));
Return text with spoiler escaped.
Params :
- text : The text to escaped (string)
Return :
The text escaped (string)
console.log(MarkdownEscaper.spoiler("Hello world"));
Return text with code block escaped.
Params :
- text : The text to escaped (string)
Return :
The text escaped (string)
console.log(MarkdownEscaper.codeBlock("Hello world"));
Return text with inline code escaped.
Params :
- text : The text to escaped (string)
Return :
The text escaped (string)
console.log(MarkdownEscaper.inlineCode("Hello world"));
Return text with bold escaped.
Params :
- text : The text to strikethrough (string)
Return :
The text escaped (string)
console.log(MarkdownEscaper.strikethrough("Hello world"));
Return id of emojis.
Params :
- text : The text to parsed (string)
Return :
An object with name and if of emoji and if is animated
console.log(MarkdownParser.emoji("Hello world <a:name:0000>"));
Return id of channels.
Params :
- text : The text to parsed (string)
Return :
An array of id of channels (Array<string>)
console.log(MarkdownParser.channel("Hello world <#0000000>"));
Return id of roles.
Params :
- text : The text to parsed (string)
Return :
An array of id of roles (Array<string>)
console.log(MarkdownParser.role("Hello world <@&000000>"));
Return id of emojis.
Params :
- text : The text to parsed (string)
Return :
An array of id of emojis (Array<string>)
console.log(MarkdownParser.guildEmoji("Hello world <a:name:0000>"));
Return id of users.
Params :
- text : The text to parsed (string)
Return :
An array of id of users (Array<string>)
console.log(MarkdownParser.user("Hello world <@0000000>"));
Return id of users.
Params :
- text : The text to parsed (string)
Return :
An array of id of users (Array<string>)
console.log(MarkdownParser.user("Hello world <@0000000>"));