Project: unifiedjs/unified-message-control

Package: unified-message-control@4.0.0

  1. Dependents: 0
  2. Enable, disable, and ignore messages from unified processors
  1. unified 179
  2. marker 13
  3. comment 9
  4. message 8
  5. unified-plugin 6
  6. control 3


Build Coverage Downloads Size Sponsors Backers Chat

unified utility to enable, disable, and ignore messages.


What is this?

This is a lego block that is meant to be extended, such as is done by remark-message-control, so that lint messages can be controlled from content.

When should I use this?

You can use this if you’re building an ecosystem like remark for some different content type, and want to let authors control messages from that content.


This package is ESM only. In Node.js (version 12.20+, 14.14+, 16.0+, or 18.0+), install with npm:

npm install unified-message-control

In Deno with esm.sh:

import messageControl from 'https://esm.sh/unified-message-control@4'

In browsers with esm.sh:

<script type="module">
  import messageControl from 'https://esm.sh/unified-message-control@4?bundle'


Say our document example.md contains:

<!--foo ignore-->

## Heading

…and our module example.js looks as follows:

import {read} from 'to-vfile'
import {reporter} from 'vfile-reporter'
import {commentMarker} from 'mdast-comment-marker'
import {unified} from 'unified'
import messageControl from 'unified-message-control'
import remarkParse from 'remark-parse'
import remarkStringify from 'remark-stringify'

const file = await read('example.md')

await unified()
  .use(() => (tree, file) => {
    file.message('Whoops!', tree.children[1], 'foo:thing')
  .use(messageControl, {
    name: 'foo',
    marker: commentMarker,
    test: 'html'


…now running node example.js yields:

example.md: no issues found


This package exports no identifiers. The default export is messageControl.

unified().use(messageControl, options)

Let comment markers control messages from certain sources.




Name of markers that can control the message sources (string).

For example, {name: 'alpha'} controls alpha markers:

<!--alpha ignore-->

Test for possible markers (Function, string, Object, or Array<Test>). See unist-util-is.


Parse a possible marker to a comment marker object (Function). If the possible marker actually isn’t a marker, should return null.


List of allowed ruleIds (Array<string>, optional). When given, a warning is shown when someone tries to control an unknown rule.

For example, {name: 'alpha', known: ['bravo']} results in a warning if charlie is configured:

<!--alpha ignore charlie-->

Whether to treat all messages as turned off initially (boolean, default: false).


List of ruleIds to initially turn on if reset: true (Array<string>, optional). By default (reset: false), all rules are turned on.


List of ruleIds to turn on if reset: false (Array<string>, optional).


Sources that can be controlled with name markers (string or Array<string>, default: options.name)



The disable keyword turns off all messages of the given rule identifiers. When without identifiers, all messages are turned off.

For example, to turn off certain messages:

<!--lint disable list-item-bullet-indent strong-marker-->

*   **foo**

A paragraph, and now another list.

  * __bar__

The enable keyword turns on all messages of the given rule identifiers. When without identifiers, all messages are turned on.

For example, to enable certain messages:

<!--lint enable strong-marker-->

**foo** and __bar__.

The ignore keyword turns off all messages of the given ruleIds occurring in the following node. When without ruleIds, all messages are ignored.

After the end of the following node, messages are turned on again.

For example, to turn off certain messages for the next node:

<!--lint ignore list-item-bullet-indent strong-marker-->

*   **foo**
    * __bar__


This package is fully typed with TypeScript. It exports the additional types Marker, MarkerParser, and Options.


Projects maintained by the unified collective are compatible with all maintained versions of Node.js. As of now, that is Node.js 12.20+, 14.14+, 16.0+, and 18.0+. Our projects sometimes work with older versions, but this is not guaranteed.


See contributing.md in unifiedjs/.github for ways to get started. See support.md for ways to get help.

This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.


MIT © Titus Wormer