md-replacer-plugin
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Markdown-It Replacer Plugin

CI NPM Version

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 in package.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:

Package Sidebar

Install

npm i md-replacer-plugin

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

31.6 kB

Total Files

23

Last publish

Collaborators

  • brenoepic