Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark-message-control

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-message-control

Enable, disable, and ignore messages with remark

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

remark-message-control Build Status Coverage Status

Enable, disable, and ignore messages with remark.

Installation

npm:

npm install remark-message-control

remark-message-control is also available for duo, and as an AMD, CommonJS, and globals module, uncompressed and compressed.

Usage

var remark = require('remark');
var lint = require('remark-lint');
var report = require('vfile-reporter');
var control = require('./index.js');

remark()
    .use(function () {
        return function (tree, file) {
            var message = file.warn('Whoops!', tree.children[1]);

            message.ruleId = 'thing';
            message.source = 'foo';
        };
    })
    .use(control, {
        'name': 'foo'
    })
    .process([
        '<!--foo ignore-->',
        '',
        '## Heading',
        ''
    ].join('\n'), function (err, file) {
        console.log(report(file));
        // <stdin>: no issues found
    });

API

remark.use(control, options)

Let comment markers control messages from a certain source.

Options:

  • name (string) — Name of markers which can control the message sources.

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

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

  • enable (Array.<string>, optional) — List of allowed ruleIds used when reset: true to initially turn on. By default (reset: false), all rules are turned on.

  • disable (Array.<string>, optional) — List of disallowed ruleIds used when reset: false to initially turn off.

  • sources (string or Array.<string>, optional) — One or more sources which markers by the specified name can control.

Markers

disable

The “disable” marker 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__
enable

The “enable” marker 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__.
ignore

The “ignore” marker turns off all messages of the given rule identifiers for the duration of the following node. When without identifiers, all messages are turned off.

After the end of the adjacent node, messages are allowed again.

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

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

*   **foo**
  * __bar__

License

MIT © Titus Wormer

Keywords

FAQs

Package last updated on 03 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc