# remark-disable-tokenizers

> This [remark][remark] plugin can disable any or all remark `blockTokenizers` and `inlineTokenizers`. It can not only disable the ones provided by remark core, but also any other tokenizer that has been added to the remark parser whether through plugins or

Latest version **1.1.1** (published 2024-04-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install remark-disable-tokenizers
pnpm add remark-disable-tokenizers
yarn add remark-disable-tokenizers
bun add remark-disable-tokenizers
```

## Health

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

Positive: no vulnerabilities; high maintenance score.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2024-04-27 |
| First published | 2017-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 236 |
| Author | Victor Felder |
| Maintainers | situphen, talone |
| Keywords | remark |

## Links

- npm: https://www.npmjs.com/package/remark-disable-tokenizers
- Repository: https://github.com/zestedesavoir/zmarkdown.git#master
- Homepage: https://github.com/zestedesavoir/zmarkdown/tree/master#readme
- Issues: https://github.com/zestedesavoir/zmarkdown/issues
- npm.io page: https://npm.io/package/remark-disable-tokenizers

## Dependencies (1)

- [clone](https://npm.io/package/clone.md) ^2.1.2

## 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.1.1 (latest) — 2024-04-27
- 1.1.0 — 2021-02-14
- 1.0.24 — 2020-02-03
- 1.0.23 — 2019-08-29
- 1.0.22 — 2019-07-27
- 1.0.21 — 2019-04-14
- 1.0.20 — 2019-02-04
- 1.0.19 — 2018-11-23
- 1.0.18 — 2018-10-04
- 1.0.17 — 2018-08-09
- 1.0.16 — 2018-07-22
- 1.0.15 — 2018-07-20
- 1.0.14 — 2018-03-06
- 1.0.13 — 2018-02-21
- 1.0.12 — 2018-01-20
- … 13 more at https://npm.io/package/remark-disable-tokenizers/versions

## README

# remark-disable-tokenizers [![Build Status][build-badge]][build-status] [![Coverage Status][coverage-badge]][coverage-status]

This [remark][remark] plugin can disable any or all remark `blockTokenizers` and `inlineTokenizers`. It can not only disable the ones provided by remark core, but also any other tokenizer that has been added to the remark parser whether through plugins or not.

Remark default tokenizers that can be disabled are listed [here][remark-doc]:

* [blockTokenizers][blockTokenizers]
* [inlineTokenizers][inlineTokenizers]

## Configuration

Two options can be passed, as a single argument object:

    {block = [], inline = []}

Each of these can contain both tokenizer names as strings or arrays `['tokenizerName', 'error message']`.

* A string `name`: this tokenizer will be disabled
* An array `[name, message]`: this tokenizer, if used, will throw an `Error` with the message `message`

## Motivation

In some situations it might be interesting to only parse inline Markdown syntax. We created it for the purpose of parsing/rendering forum signatures -- short textual content people can use to sign their messages on web forums. In this context it made no sense to allow elements that would eat up a lot of vertical space.

## Installation

[npm][npm]:

```bash
npm install remark-disable-tokenizers
```

## Usage

Dependencies:

```javascript
const unified = require('unified')
const remarkParse = require('remark-parse')
const stringify = require('rehype-stringify')
const remark2rehype = require('remark-rehype')

const remarkDisableBlocks = require('remark-disable-tokenizers')
```

Usage:

```javascript
unified()
  .use(remarkParse)
  .use(remarkDisableTokenizers, {
    block: [
      'indentedCode',
      'fencedCode',
      // I'd like to ignore a bunch of blockTokenizers but specifically
      // I want blockquotes to throw this `Error` if used in the input Markdown
      ['blockquote', 'Blockquote are not allowed!'],
      'atxHeading',
      'setextHeading',
      'footnote',
      'table',
      'custom_blocks'
    ],
    inline: [
      'emphasis' // emphasis is the only inlineTokenizer I'm disallowing
    ]
  })
  .use(remark2rehype)
  .use(stringify)
```

## Caveats

* `autoLink` is not working correctly -- in order to disable auto-linking, you have to pass `url` to the array of disabled inline tokenizers.

```javascript
unified()
  .use(remarkParse)
  .use(remarkDisableTokenizers, {
    inline: ['url']
  })
  .use(remark2rehype)
  .use(stringify)
```

## License

[MIT][license] © [Zeste de Savoir][zds]

<!-- Definitions -->

[build-badge]: https://img.shields.io/travis/zestedesavoir/zmarkdown.svg

[build-status]: https://travis-ci.org/zestedesavoir/zmarkdown

[coverage-badge]: https://img.shields.io/coveralls/zestedesavoir/zmarkdown.svg

[coverage-status]: https://coveralls.io/github/zestedesavoir/zmarkdown

[license]: https://github.com/zestedesavoir/zmarkdown/blob/master/packages/remark-disable-tokenizers/LICENSE-MIT

[zds]: https://zestedesavoir.com

[npm]: https://www.npmjs.com/package/remark-disable-tokenizers

[remark]: https://github.com/remarkjs/remark

[remark-doc]: https://github.com/remarkjs/remark/tree/master/packages/remark-parse#parserblocktokenizers

[blockTokenizers]: https://github.com/remarkjs/remark/tree/master/packages/remark-parse#parserblockmethods

[inlineTokenizers]: https://github.com/remarkjs/remark/tree/master/packages/remark-parse#parserinlinemethods

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