{"id":27732859,"url":"https://github.com/unifiedjs/unified-message-control","last_synced_at":"2025-04-28T11:47:25.203Z","repository":{"id":57386246,"uuid":"117106711","full_name":"unifiedjs/unified-message-control","owner":"unifiedjs","description":"plugin to enable, disable, and ignore messages","archived":false,"fork":false,"pushed_at":"2023-09-28T08:15:38.000Z","size":193,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-19T17:55:28.296Z","etag":null,"topics":["message","unified","unified-plugin","unifiedjs"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unifiedjs.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2018-01-11T13:51:31.000Z","updated_at":"2024-01-30T07:11:38.000Z","dependencies_parsed_at":"2022-09-02T01:10:31.438Z","dependency_job_id":"e2047513-b282-4bb1-bd72-163d2da827db","html_url":"https://github.com/unifiedjs/unified-message-control","commit_stats":{"total_commits":137,"total_committers":6,"mean_commits":"22.833333333333332","dds":"0.13868613138686137","last_synced_commit":"19a1860f7d0fb245e3a4b1b8b15be6f89fb328db"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unifiedjs%2Funified-message-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unifiedjs%2Funified-message-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unifiedjs%2Funified-message-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unifiedjs%2Funified-message-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unifiedjs","download_url":"https://codeload.github.com/unifiedjs/unified-message-control/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251112950,"owners_count":21538168,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["message","unified","unified-plugin","unifiedjs"],"created_at":"2025-04-28T11:47:24.375Z","updated_at":"2025-04-28T11:47:25.197Z","avatar_url":"https://github.com/unifiedjs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":[],"sub_categories":[],"readme":"# unified-message-control\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[unified][] utility to enable, disable, and ignore messages.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`messageControl(tree, options)`](#messagecontroltree-options)\n    *   [`Marker`](#marker)\n    *   [`MarkerParser`](#markerparser)\n    *   [`Options`](#options)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis is a lego block that is meant to be extended, such as is done by\n[`remark-message-control`][remark-message-control], so that lint messages can be\ncontrolled from content.\n\n## When should I use this?\n\nYou can use this if you’re building an ecosystem like remark for some different\ncontent type, and want to let authors control messages from that content.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install unified-message-control\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {messageControl} from 'https://esm.sh/unified-message-control@5'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {messageControl} from 'https://esm.sh/unified-message-control@5?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\nSay our document `example.md` contains:\n\n```markdown\n\u003c!--foo ignore--\u003e\n\n## Heading\n```\n\n…and our module `example.js` looks as follows:\n\n```js\nimport {commentMarker} from 'mdast-comment-marker'\nimport remarkParse from 'remark-parse'\nimport remarkStringify from 'remark-stringify'\nimport {read} from 'to-vfile'\nimport {unified} from 'unified'\nimport {messageControl} from 'unified-message-control'\nimport {reporter} from 'vfile-reporter'\n\nconst file = await read('example.md')\n\nawait unified()\n  .use(remarkParse)\n  .use(remarkStringify)\n  .use(function () {\n    return function (tree, file) {\n      file.message('Whoops!', tree.children[1], 'foo:thing')\n    }\n  })\n  .use(messageControl, {\n    marker: commentMarker,\n    name: 'foo',\n    test: 'html'\n  })\n  .process(file)\n\nconsole.error(reporter(file))\n```\n\n…now running `node example.js` yields:\n\n```markdown\nexample.md: no issues found\n```\n\n## API\n\nThis package exports no identifiers.\nIt exports the identifier [`messageControl`][api-message-control].\n\n### `messageControl(tree, options)`\n\nLet comment markers control messages.\n\n###### Parameters\n\n*   `tree` ([`Node`][node])\n    — tree\n*   `options` ([`Options`][api-options])\n    — configuration (required)\n\n###### Returns\n\nNothing (`undefined`).\n\n### `Marker`\n\nComment marker (TypeScript type).\n\n###### Notes\n\nThe **disable** keyword turns off messages.\nFor example:\n\n```markdown\n\u003c!--lint disable list-item-bullet-indent strong-marker--\u003e\n\n*   **foo**\n\nA paragraph, and now another list.\n\n  * __bar__\n```\n\nThe **enable** keyword turns on messages.\nFor example:\n\n```markdown\n\u003c!--lint enable strong-marker--\u003e\n\n**foo** and __bar__.\n```\n\nThe **ignore** keyword turns off messages in the following node.\nAfter the end of the following node, messages are turned on again.\nFor example:\n\n```markdown\n\u003c!--lint ignore list-item-bullet-indent strong-marker--\u003e\n\n*   **foo**\n    * __bar__\n```\n\n###### Fields\n\n*   `name` (`string`)\n    — name of marker\n*   `attributes` (`string`)\n    — raw values (space-separated); the first should be `enable`, `disable`, or\n    `ignore`, the rest are optional rule identifiers\n\n### `MarkerParser`\n\nParse a possible comment marker (TypeScript type).\n\n###### Parameters\n\n*   `node` ([`Node`][node])\n    — potential marker\n\n###### Returns\n\n`Marker` ([`Marker`][marker], optional).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Notes\n\nThe given `name` defines which comments work.\nAssuming there’s a `marker` configured that parses HTML comments such as\n`\u003c!--x y z--\u003e` to a mark with `name: 'x'`, then giving `name: 'x'` will\nuse comments such as:\n\n```html\n\u003c!--alpha ignore--\u003e\n```\n\nWhen `known` is given, a warning is shown when unknown rules are controlled.\nFor example, `{name: 'alpha', known: ['bravo']}` results in a warning (for\n`charlie`):\n\n```html\n\u003c!--alpha ignore charlie--\u003e\n```\n\n###### Fields\n\n*   `enable` (`Array\u003cstring\u003e`, optional)\n    — list of `ruleId`s to initially turn on; used if `reset` is `true`\n*   `disable` (`Array\u003cstring\u003e`, optional)\n    — list of `ruleId`s to initially turn off; used if `reset` is not `true`\n*   `known` (`Array\u003cstring\u003e`, optional)\n    — list of allowed `ruleId`s\n*   `file` ([`VFile`][vfile], **required**)\n    — corresponding file\n*   `marker` ([`MarkerParser`][api-marker-parser], **required**)\n    — parse nodes to [`Marker`][api-marker] objects\n*   `name` (`string`, **required**)\n    — name of markers that can control the message sources\n*   `reset` (`boolean`, default: `false`)\n    — whether to treat all messages as turned off initially\n*   `source` (`Array\u003cstring\u003e` or `string`, default: `options.name`)\n    — [sources][vfile-message-fields] that can be controlled with markers\n*   `test` ([`Test`][unist-util-is-test], optional)\n    — test for possible markers\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional types\n[`Marker`][api-marker],\n[`MarkerParser`][api-marker-parser], and\n[`Options`][api-options].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line,\n`unified-message-control@^5`, compatible with Node.js 16.\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`unifiedjs/.github`][health] for ways\nto get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/unifiedjs/unified-message-control/workflows/main/badge.svg\n\n[build]: https://github.com/unifiedjs/unified-message-control/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/unifiedjs/unified-message-control.svg\n\n[coverage]: https://codecov.io/github/unifiedjs/unified-message-control\n\n[downloads-badge]: https://img.shields.io/npm/dm/unified-message-control.svg\n\n[downloads]: https://www.npmjs.com/package/unified-message-control\n\n[size-badge]: https://img.shields.io/bundlejs/size/unified-message-control\n\n[size]: https://bundlephobia.com/result?p=unified-message-control\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/unifiedjs/unified/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[health]: https://github.com/unifiedjs/.github\n\n[contributing]: https://github.com/unifiedjs/.github/blob/main/contributing.md\n\n[support]: https://github.com/unifiedjs/.github/blob/main/support.md\n\n[coc]: https://github.com/unifiedjs/.github/blob/main/ncode-of-conduct.md\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[marker]: https://github.com/syntax-tree/mdast-comment-marker#marker\n\n[unified]: https://github.com/unifiedjs/unified\n\n[remark-message-control]: https://github.com/remarkjs/remark-message-control\n\n[vfile]: https://github.com/vfile/vfile\n\n[node]: https://github.com/syntax-tree/unist#node\n\n[unist-util-is-test]: https://github.com/syntax-tree/unist-util-is#api\n\n[vfile-message-fields]: https://github.com/vfile/vfile-message/tree/main#fields\n\n[api-marker]: #marker\n\n[api-marker-parser]: #markerparser\n\n[api-message-control]: #messagecontroltree-options\n\n[api-options]: #options\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funifiedjs%2Funified-message-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funifiedjs%2Funified-message-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funifiedjs%2Funified-message-control/lists"}