Registry / web-framework / markdown-it-chain

markdown-it-chain

JSON →
library1.3.0jsnpmunverified

A chaining API for markdown-it, similar to webpack-chain, enabling declarative configuration of markdown-it options and plugins. Version 1.3.0 is the latest and only stable release; no further updates are expected. It requires markdown-it >=5.0.0 as a peer dependency. The package provides a fluent, jQuery-like chain for setting HTML/typographer options and registering plugins with before/after ordering. Its key differentiator is providing a structured, webpack-chain-inspired API for markdown-it, which is useful for complex configurations where order of plugins matters. It is not actively maintained and has no built-in TypeScript types.

npm install markdown-it-chain
INSTALL
IMPORT
SIG · MARKDOWN-IT-CHAIN
M
markdown-it-chain
web-frameworkjavascriptv1.3.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const Config = require('markdown-it-chain')
import Config from 'markdown-it-chain'
Package is CommonJS only; ESM import will fail without a default export wrapper.
Config
import Config from 'markdown-it-chain'
import { Config } from 'markdown-it-chain'
Only a default export is provided; named import will yield undefined.
ChainedMap
not exported directly; accessed via config.options or config.plugin()
import { ChainedMap } from 'markdown-it-chain'
ChainedMap is an internal pattern inherited from webpack-chain; not exported from this package.

Creates a markdown-it configuration via chain API, adds plugins with ordering, and renders Markdown.

const Config = require('markdown-it-chain'); const config = new Config(); config .options .html(true) .linkify(true) .end() .plugin('toc') .use(require('markdown-it-table-of-contents'), [{ includeLevel: [2, 3] }]) .end() .plugin('anchor') .use(require('markdown-it-anchor'), [{ permalink: true, permalinkBefore: true, permalinkSymbol: '$' }]) .before('toc'); const md = config.toMd(); const result = md.render('[[TOC]]\n# h1\n## h2\n## h3'); console.log(result);
Debug
Known issues
breakingPackage is CommonJS-only; ESM environments like Node >=14 with 'type': 'module' require dynamic import or transpilation.
fix
Use dynamic import: const Config = (await import('markdown-it-chain')).default; or transpile with bundler.
affects: >=1.0.0
deprecatedNo updates since initial 1.3.0 release (2019); consider alternatives like direct markdown-it usage or other configuration helpers.
fix
Use plain markdown-it API or evaluate if chaining is needed.
affects: >=1.0.0
gotchaPlugin ordering via .before() and .after() only works when multiple plugins are added to the same config instance; relative order may confuse.
fix
Explicitly call .before() or .after() on the plugin being ordered, referencing the name of the other plugin.
affects: >=1.0.0
gotchaThe .use() method expects an array as second argument (plugin options); omitting array brackets for single option may cause undefined behavior.
fix
Always pass plugin options as an array: .use(plugin, [options]) even if single option.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Config is not a constructor
Using ES module import (import Config from 'markdown-it-chain') which yields undefined because package has no default export in ESM context.
fix
Switch to CommonJS require: const Config = require('markdown-it-chain'); or use createRequire in ESM.
Error: Cannot find module 'markdown-it'
Missing peer dependency markdown-it which is required at runtime when calling .toMd().
fix
Install markdown-it: npm install markdown-it --save
TypeError: config.options.html is not a function
Using .html() without calling .options chain first; options methods are only available after accessing the ChainedMap via config.options.
fix
Ensure you use config.options.html(...).end(); use .set() if direct access needed.
Upgrade
Version history
1.3.0latest on npm
Audit
Dependencies
markdown-itrequiredpeer dependency required to create markdown-it instance via .toMd()
Agent activity
6 hits · last 30 days
node
6
Resources
markdown-it-chain — npm install markdown-it-chain · libregistry