Gathering detailed insights and metrics for unified-message-control
Gathering detailed insights and metrics for unified-message-control
Gathering detailed insights and metrics for unified-message-control
Gathering detailed insights and metrics for unified-message-control
npm install unified-message-control
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
7 Stars
140 Commits
3 Forks
7 Watchers
1 Branches
15 Contributors
Updated on Jan 30, 2024
Latest Version
5.0.0
Package Id
unified-message-control@5.0.0
Unpacked Size
27.77 kB
Size
8.09 kB
File Count
7
NPM Version
9.7.2
Node Version
20.0.0
Published on
Aug 23, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
unified utility to enable, disable, and ignore messages.
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.
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 16+), install with npm:
1npm install unified-message-control
In Deno with esm.sh
:
1import {messageControl} from 'https://esm.sh/unified-message-control@5'
In browsers with esm.sh
:
1<script type="module"> 2 import {messageControl} from 'https://esm.sh/unified-message-control@5?bundle' 3</script>
Say our document example.md
contains:
1<!--foo ignore--> 2 3## Heading
…and our module example.js
looks as follows:
1import {commentMarker} from 'mdast-comment-marker' 2import remarkParse from 'remark-parse' 3import remarkStringify from 'remark-stringify' 4import {read} from 'to-vfile' 5import {unified} from 'unified' 6import {messageControl} from 'unified-message-control' 7import {reporter} from 'vfile-reporter' 8 9const file = await read('example.md') 10 11await unified() 12 .use(remarkParse) 13 .use(remarkStringify) 14 .use(function () { 15 return function (tree, file) { 16 file.message('Whoops!', tree.children[1], 'foo:thing') 17 } 18 }) 19 .use(messageControl, { 20 marker: commentMarker, 21 name: 'foo', 22 test: 'html' 23 }) 24 .process(file) 25 26console.error(reporter(file))
…now running node example.js
yields:
1example.md: no issues found
This package exports no identifiers.
It exports the identifier messageControl
.
messageControl(tree, options)
Let comment markers control messages.
Nothing (undefined
).
Marker
Comment marker (TypeScript type).
The disable keyword turns off messages. For example:
1<!--lint disable list-item-bullet-indent strong-marker--> 2 3* **foo** 4 5A paragraph, and now another list. 6 7 * __bar__
The enable keyword turns on messages. For example:
1<!--lint enable strong-marker--> 2 3**foo** and __bar__.
The ignore keyword turns off messages in the following node. After the end of the following node, messages are turned on again. For example:
1<!--lint ignore list-item-bullet-indent strong-marker--> 2 3* **foo** 4 * __bar__
name
(string
)
— name of markerattributes
(string
)
— raw values (space-separated); the first should be enable
, disable
, or
ignore
, the rest are optional rule identifiersMarkerParser
Parse a possible comment marker (TypeScript type).
node
(Node
)
— potential markerMarker
(Marker
, optional).
Options
Configuration (TypeScript type).
The given name
defines which comments work.
Assuming there’s a marker
configured that parses HTML comments such as
<!--x y z-->
to a mark with name: 'x'
, then giving name: 'x'
will
use comments such as:
1<!--alpha ignore-->
When known
is given, a warning is shown when unknown rules are controlled.
For example, {name: 'alpha', known: ['bravo']}
results in a warning (for
charlie
):
1<!--alpha ignore charlie-->
enable
(Array<string>
, optional)
— list of ruleId
s to initially turn on; used if reset
is true
disable
(Array<string>
, optional)
— list of ruleId
s to initially turn off; used if reset
is not true
known
(Array<string>
, optional)
— list of allowed ruleId
sfile
(VFile
, required)
— corresponding filemarker
(MarkerParser
, required)
— parse nodes to Marker
objectsname
(string
, required)
— name of markers that can control the message sourcesreset
(boolean
, default: false
)
— whether to treat all messages as turned off initiallysource
(Array<string>
or string
, default: options.name
)
— sources that can be controlled with markerstest
(Test
, optional)
— test for possible markersThis package is fully typed with TypeScript.
It exports the additional types
Marker
,
MarkerParser
, and
Options
.
Projects maintained by the unified collective are compatible with maintained versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
unified-message-control@^5
, compatible with Node.js 16.
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.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More