Skip to content

brenoepics/markdown-it-replacer

Repository files navigation

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:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published