What is remark-lint-no-unused-definitions?
The remark-lint-no-unused-definitions package is a plugin for remark-lint that checks for unused definitions in Markdown files. It helps maintain clean and efficient Markdown documents by ensuring that all definitions are used.
What are remark-lint-no-unused-definitions's main functionalities?
Linting for Unused Definitions
The primary feature of remark-lint-no-unused-definitions is to identify and report definitions in Markdown files that are declared but not used. In the provided code sample, the definition `[unused]: https://unused.com` is not used anywhere in the document, and the plugin would flag this as an issue.
```markdown
# Example
This is a [link][example].
[example]: https://example.com
This is an unused definition:
[unused]: https://unused.com
```
Other packages similar to remark-lint-no-unused-definitions
remark-lint
remark-lint is a general-purpose Markdown linter that provides a wide range of rules for checking Markdown files. While it does not specifically focus on unused definitions, it can be extended with plugins like remark-lint-no-unused-definitions to cover this functionality.
markdownlint
markdownlint is a Node.js style checker and linting tool for Markdown files. It offers a variety of rules to enforce consistent Markdown style, including some that overlap with the functionality of remark-lint-no-unused-definitions, such as checking for unused links and references.
markdown-it
markdown-it is a Markdown parser that can be extended with plugins to add various functionalities, including linting. While it is primarily focused on parsing, plugins can be added to perform checks similar to those provided by remark-lint-no-unused-definitions.

Warn when unused definitions are found.
Presets
This rule is included in the following presets:
Example
valid.md
In
[foo][]
[foo]: https://example.com
Out
No messages.
invalid.md
In
[bar]: https://example.com
Out
1:1-1:27: Found unused definition
Install
npm:
npm install remark-lint-no-unused-definitions
Use
You probably want to use it on the CLI through a config file:
...
"remarkConfig": {
"plugins": [
...
"lint",
+ "lint-no-unused-definitions",
...
]
}
...
Or use it on the CLI directly
remark -u lint -u lint-no-unused-definitions readme.md
Or use this on the API:
var remark = require('remark');
var report = require('vfile-reporter');
remark()
.use(require('remark-lint'))
+ .use(require('remark-lint-no-unused-definitions'))
.process('_Emphasis_ and **importance**', function (err, file) {
console.error(report(err || file));
});
Contribute
See contributing.md
in remarkjs/.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, organisation, or community you agree to
abide by its terms.
License
MIT © Titus Wormer