md-replacer-plugin
v1.0.1
Published
A markdown-it plugin to replace vars in the markdown
Downloads
3
Maintainers
Readme
Markdown-It Replacer Plugin
A markdown-it plugin that allows you to replace markdown content with custom content.
Install:
npm i md-replacer-plugin
yarn add md-replacer-plugin
Usage
As a Node module:
import MarkdownIt from "markdown-it"
import replaceVarPlugin from "md-replacer-plugin"
const text = MarkdownIt().use(replaceVarPlugin, { variable: "testing" }).render("variable")
Design choices
Why is markdown-it only in devDependencies?
From the markdown-it development recommendations:
Plugins should not require the
markdown-it
package as a dependency inpackage.json
.
Note, for typing, we import this package with import type
, to ensure the imports are not present in the compiled JavaScript.
Why Jest?
There are a number of JavaScript unit testing frameworks (see this comparison, but [jest] was chosen because of it is easy to setup/use, flexible, and well used in large projects.
Why Rollup?
The three main bundlers are; Webpack, Rollup and Parcel, with the functionality gap between all of these bundlers narrowing over the years.
Essentially, Rollup provides a middle ground between features and complexity, and is good for bundling libraries (it is what markdown-it
itself uses).
See, for example: