
Product
Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
markdown-it-replacements
Advanced tools
This markdown-it plugin replaces the "replacements" feature in markdown-it typographer, allowing you to customize the replacement rules (regular expression substitutions) done to inline text outside of autolinks.
There are four built-in replacement rules (mimicking some of the built-in markdown-it typographer):
+-
→ ± (rule "plusminus")...
→ … (rule "ellipsis")---
→ — (rule "mdash")--
→ – (rule "ndash")Each rule can be turned off by specifying an option object when using the
module (mapping each undesired rule name to false
).
Additional rules can be added by modifying the replacements
module attribute
(an array of rules, where each rule
has a name rule.name
,
regular expression rule.re
, substitution rule.sub
, and boolean
default on/off rule.default
).
// Without smart quotes
md = require('markdown-it')()
.use(require('markdown-it-replacements'));
md.renderInline('Hello... "world"---');
// -> 'Hello… "world"—'
// With smart quotes
md = require('markdown-it')({typographer: true})
.use(require('markdown-it-replacements'));
md.renderInline('Hello... "world"---');
// -> 'Hello… “world”—'
// Using options to turn specific replacements on/off
md = require('markdown-it')({typographer: true})
.use(require('markdown-it-replacements'), {mdash: false});
md.renderInline('Hello... "world"---');
// -> 'Hello… “world”---'
// Adding custom replacements
mir = require('markdown-it-replacements');
mir.replacements.push({
name: 'allcaps',
re: /[a-z]/g,
sub: function (s) { return s.toUpperCase(); },
default: true
});
md = require('markdown-it')({typographer: true}).use(mir);
md.renderInline('Hello... "world"---');
// -> 'HELLO… “WORLD”—'
typographer
option to be set to true. (The reasoning being
that, if you're using this module, you probably want to do the
substitutions.) This means that the typographer
option effectively
controls whether to do smart-quote substitution.FAQs
Customize replacements in markdown-it typographer
We found that markdown-it-replacements 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.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.