# markdown-it-chain

> A chaining API like webpack-chain but for markdown-it.

Latest version **1.3.0** (published 2018-11-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install markdown-it-chain
pnpm add markdown-it-chain
yarn add markdown-it-chain
bun add markdown-it-chain
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.0 |
| Published | 2018-11-29 |
| First published | 2018-08-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.9 |
| Dependencies | 1 |
| Unpacked size | 8.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 31 |
| Author | ULIVZ |
| Maintainers | ulivz |
| Keywords | markdown-it, chain |

## Links

- npm: https://www.npmjs.com/package/markdown-it-chain
- Repository: https://github.com/ULIVZ/markdown-it-chain
- Homepage: https://github.com/ULIVZ/markdown-it-chain#readme
- Issues: https://github.com/ULIVZ/markdown-it-chain/issues
- npm.io page: https://npm.io/package/markdown-it-chain

## Dependencies (1)

- [webpack-chain](https://npm.io/package/webpack-chain.md) ^4.9.0

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.3.0 (latest) — 2018-11-29
- 1.2.1 — 2018-10-09
- 1.2.0 — 2018-09-22
- 1.1.2 — 2018-09-22
- 1.1.1 — 2018-09-22
- 1.1.0 — 2018-08-22

## README

# markdown-it-chain

> A chaining API like [webpack-chain](https://github.com/neutrinojs/webpack-chain) but for [markdown-it](https://markdown-it.github.io/markdown-it/).

[![NPM version](https://img.shields.io/npm/v/markdown-it-chain.svg?style=flat)](https://npmjs.com/package/markdown-it-chain)  

## Install

**Yarn**

```bash
yarn add -dev markdown-it-chain
```

**npm**

```bash
npm install --save-dev markdown-it-chain
```

## Getting Started

```js
// Require the markdown-it-chain module. This module exports a single
// constructor function for creating a configuration API.
const Config = require('markdown-it-chain')

// Instantiate the configuration with a new API
const config = new Config()

// Make configuration changes using the chain API.
// Every API call tracks a change to the stored configuration.
config
  // Interact with 'options' in new MarkdownIt
  // Ref: https://markdown-it.github.io/markdown-it/#MarkdownIt.new
  .options
    .html(true) // equal to .set('html', true)
    .linkify(true)
    .end()

  // Interact with 'plugins'
  .plugin('toc')
    // The first parameter is the plugin module, which may be a function
    // while the second parameter is an array of parameters accepted by the plugin.
    .use(require('markdown-it-table-of-contents'), [{
      includeLevel: [2, 3]
    }])
    // Move up one level, like .end() in jQuery.
    .end()

  .plugin('anchor')
    .use(require('markdown-it-anchor'), [{
      permalink: true,
      permalinkBefore: true,
      permalinkSymbol: '$'
    }])
    // Apply this plugin before toc.
    .before('toc')

// Create a markdown-it instance using the above configuration
const md = config.toMd()
md.render('[[TOC]] \n # h1 \n ## h2 \n ## h3 ')
```

## Worth Reading

In order to ensure the consistency of the chained API world, `webpack-it-chain` is developed directly on the basis of [webpack-chain](https://github.com/neutrinojs/webpack-chain) and ensures that the usage is completely consistent.

Here are some things worth reading that come from `webpack-chain`:

- [ChainedMap](https://github.com/neutrinojs/webpack-chain#chainedmap)
- [Config plugins](https://github.com/neutrinojs/webpack-chain#config-plugins)

## Author

**markdown-it-chain** © [ULIVZ](https://github.com/ULIVZ), Released under the [MIT](./LICENSE) License.<br>
Authored and maintained by ULIVZ with help from contributors ([list](https://github.com/ULIVZ/markdown-it-chain/contributors)).

> [github.com/ulivz](https://github.com/ULIVZ) · GitHub [@ULIVZ](https://github.com/ULIVZ) · Twitter [@_ulivz](https://twitter.com/_ulivz)

---
_Source: https://npm.io/package/markdown-it-chain · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
