Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
discord-markdown
Advanced tools
A markdown parser for Discord messages.
yarn add discord-markdown
npm i discord-markdown
const { parser, htmlOutput, toHTML } = require('discord-markdown');
console.log(toHTML('This **is** a __test__'));
// => This <strong>is</strong> a <u>test</u>
Fenced codeblocks will include highlight.js tags and classes.
const { toHTML } = require('discord-markdown');
toHTML('This **is** a __test__', options);
options
is an object with the following properties (all are optional):
embed
: Boolean (default: false), if it should parse embed contents (rules are slightly different)escapeHTML
: Boolean (default: true), if it should escape HTMLdiscordOnly
: Boolean (default: false), if it should only parse the discord-specific stuffdiscordCallback
: Object, callbacks used for discord parsing. Each receive an object with different properties, and are expected to return an HTML escaped string
user
: (id
: Number) User mentions "@someperson"channel
: (id
: Number) Channel mentions "#somechannel"role
: (id
: Number) Role mentions "@somerole"emoji
: (animated
: Boolean, name
: String, id
: Number) emojis ":emote":everyone
: () Everyone mention "@everyone"here
: () Here mention "@here"cssModuleNames
: Object, maps CSS class names to CSS module class namesUsing the discordCallback
option you can define custom functions to handle parsing mention and emoji content. You can use these to turn IDs into names.
Example:
const { toHTML } = require('discord-markdown');
toHTML('This is a mention for <@95286900801146880>', {
discordCallback: {
user: node => '@' + users[node.id];
}
}); // -> This is a mention for @Brussell
Find an inconsistency? File an issue or submit a pull request with the fix and updated test(s).
2.1.0 (2018-12-14)
This release improves on the library to make it easier to use and less error-prone.
options.cssModuleNames
span
tags, including scoped classes for styling.FAQs
A markdown parser for Discord messages
The npm package discord-markdown receives a total of 223 weekly downloads. As such, discord-markdown popularity was classified as not popular.
We found that discord-markdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.