{"id":20199,"library":"markdown-it-chain","title":"markdown-it-chain","description":"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.","status":"maintenance","version":"1.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/ULIVZ/markdown-it-chain","tags":["javascript","markdown-it","chain"],"install":[{"cmd":"npm install markdown-it-chain","lang":"bash","label":"npm"},{"cmd":"yarn add markdown-it-chain","lang":"bash","label":"yarn"},{"cmd":"pnpm add markdown-it-chain","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to create markdown-it instance via .toMd()","package":"markdown-it","optional":false}],"imports":[{"note":"Package is CommonJS only; ESM import will fail without a default export wrapper.","wrong":"import Config from 'markdown-it-chain'","symbol":"default","correct":"const Config = require('markdown-it-chain')"},{"note":"Only a default export is provided; named import will yield undefined.","wrong":"import { Config } from 'markdown-it-chain'","symbol":"Config","correct":"import Config from 'markdown-it-chain'"},{"note":"ChainedMap is an internal pattern inherited from webpack-chain; not exported from this package.","wrong":"import { ChainedMap } from 'markdown-it-chain'","symbol":"ChainedMap","correct":"not exported directly; accessed via config.options or config.plugin()"}],"quickstart":{"code":"const Config = require('markdown-it-chain');\nconst config = new Config();\nconfig\n  .options\n    .html(true)\n    .linkify(true)\n    .end()\n  .plugin('toc')\n    .use(require('markdown-it-table-of-contents'), [{ includeLevel: [2, 3] }])\n    .end()\n  .plugin('anchor')\n    .use(require('markdown-it-anchor'), [{ permalink: true, permalinkBefore: true, permalinkSymbol: '$' }])\n    .before('toc');\nconst md = config.toMd();\nconst result = md.render('[[TOC]]\\n# h1\\n## h2\\n## h3');\nconsole.log(result);","lang":"javascript","description":"Creates a markdown-it configuration via chain API, adds plugins with ordering, and renders Markdown."},"warnings":[{"fix":"Use dynamic import: const Config = (await import('markdown-it-chain')).default; or transpile with bundler.","message":"Package is CommonJS-only; ESM environments like Node >=14 with 'type': 'module' require dynamic import or transpilation.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Use plain markdown-it API or evaluate if chaining is needed.","message":"No updates since initial 1.3.0 release (2019); consider alternatives like direct markdown-it usage or other configuration helpers.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Explicitly call .before() or .after() on the plugin being ordered, referencing the name of the other plugin.","message":"Plugin ordering via .before() and .after() only works when multiple plugins are added to the same config instance; relative order may confuse.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always pass plugin options as an array: .use(plugin, [options]) even if single option.","message":"The .use() method expects an array as second argument (plugin options); omitting array brackets for single option may cause undefined behavior.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Switch to CommonJS require: const Config = require('markdown-it-chain'); or use createRequire in ESM.","cause":"Using ES module import (import Config from 'markdown-it-chain') which yields undefined because package has no default export in ESM context.","error":"TypeError: Config is not a constructor"},{"fix":"Install markdown-it: npm install markdown-it --save","cause":"Missing peer dependency markdown-it which is required at runtime when calling .toMd().","error":"Error: Cannot find module 'markdown-it'"},{"fix":"Ensure you use config.options.html(...).end(); use .set() if direct access needed.","cause":"Using .html() without calling .options chain first; options methods are only available after accessing the ChainedMap via config.options.","error":"TypeError: config.options.html is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}