Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
markdownlint-cli2
Advanced tools
A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the `markdownlint` library
markdownlint-cli2 is a command-line interface for the markdownlint library, which is used to lint Markdown files. It helps ensure that Markdown files adhere to a consistent style and are free of common errors.
Linting Markdown Files
This command lints all Markdown files in the current directory and its subdirectories. It checks for common issues and style inconsistencies in Markdown files.
npx markdownlint-cli2 '**/*.md'
Using a Configuration File
This command uses a configuration file (.markdownlint.json) to specify custom linting rules. This allows for more granular control over the linting process.
npx markdownlint-cli2 '**/*.md' --config .markdownlint.json
Fixing Issues Automatically
This command not only lints the Markdown files but also attempts to fix any issues it finds automatically. This can save time by correcting common mistakes without manual intervention.
npx markdownlint-cli2-fix '**/*.md'
Ignoring Files
This command lints all Markdown files but ignores those in the node_modules directory. This is useful for excluding third-party files from the linting process.
npx markdownlint-cli2 '**/*.md' --ignore node_modules
remark-cli is a command-line interface for the remark library, which is used to process Markdown files. It offers similar functionality to markdownlint-cli2, including linting and formatting, but is part of the larger unified ecosystem, which provides a wide range of plugins for additional processing tasks.
markdownlint is the core library that markdownlint-cli2 is based on. It provides the underlying linting functionality and can be used programmatically within Node.js applications. While it does not offer a command-line interface out of the box, it can be integrated into custom scripts and build processes.
mdlint is another Markdown linter that focuses on simplicity and ease of use. It provides a basic set of linting rules and can be used as a command-line tool. While it may not be as feature-rich as markdownlint-cli2, it is a good option for users who need a straightforward linting solution.
A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the
markdownlint
library
As a global CLI:
npm install markdownlint-cli2 --global
As a development dependency of the current package:
npm install markdownlint-cli2 --save-dev
markdownlint
is a library for linting Markdown/
CommonMark files on Node.js using the
markdown-it parser.markdownlint-cli
is a traditional command-line interface
for markdownlint
.markdownlint-cli2
is a slightly unconventional
command-line interface for markdownlint
.markdownlint-cli2
is configuration-based and prioritizes speed and
simplicity.markdownlint-cli2
supports all the features of markdownlint-cli
(sometimes
a little differently).vscode-markdownlint
is a markdownlint
extension for
the Visual Studio Code editor.markdownlint-cli2
is designed to work well in conjunction with
vscode-markdownlint
.markdownlint-cli2 version X.Y.Z by David Anson (https://dlaa.me/)
https://github.com/DavidAnson/markdownlint-cli2
Syntax: markdownlint-cli2 glob0 [glob1] [...] [globN]
Glob expressions (from the globby library):
- * matches any number of characters, but not /
- ? matches a single character, but not /
- ** matches any number of characters, including / (when it's the only thing in a path part)
- {} allows for a comma-separated list of "or" expressions
- ! or # at the beginning of a pattern negate the match
Dot-only glob:
- The command "markdownlint-cli2 ." would lint every file in the current directory tree which is probably not intended
- Instead, it is mapped to "markdownlint-cli2 *.{md,markdown}" which lints all Markdown files in the current directory
- To lint every file in the current directory tree, the command "markdownlint-cli2 **" can be used instead
Configuration via:
- .markdownlint-cli2.jsonc
- .markdownlint-cli2.js
- .markdownlint.jsonc or .markdownlint.json
- .markdownlint.yaml or .markdownlint.yml
- .markdownlint.js
Cross-platform compatibility:
- UNIX and Windows shells expand globs according to different rules, so quoting glob arguments is recommended
- Shells that expand globs do not support negated patterns (!node_modules), so quoting negated globs is required
- Some Windows shells do not handle single-quoted (') arguments correctly, so double-quotes (") are recommended
- Some UNIX shells handle exclamation (!) in double-quotes specially, so hashtag (#) is recommended for negated globs
- Some shells use backslash (\) to escape special characters, so forward slash (/) is the recommended path separator
Therefore, the most compatible glob syntax for cross-platform support:
$ markdownlint-cli2 "**/*.md" "#node_modules"
0
: Linting was successful and there were no errors1
: Linting was successful and there were errors2
: Linting was not completed due to a runtime issuemarkdownlint
documentation.markdownlint
documentation for information about the inline comment syntax
for enabling and disabling rules with HTML comments..markdownlint-cli2.jsonc
markdownlint
options
object.config
: markdownlint
config
object to configure
rules for this part of the directory tree
.markdownlint.{jsonc,json,yaml,yml,js}
file (see below) is present
in the same directory, it overrides the value of this propertycustomRules
: Array
of Strings
of module names/paths of
custom rules to load and use when linting
String
is passed as the id
parameter to Node's
require functionJSONC
filefix
: Boolean
value to enable fixing of linting errors reported by rules
that emit fix information
frontMatter
: String
defining the RegExp
used to match and
ignore any front matter at the beginning of a document
String
is passed as the pattern
parameter to the
RegExp
constructor(^---\s*$[^]*?^---\s*$)(\r\n|\r|\n|$)
ignores
: Array
of Strings
defining glob expressions to ignore when
linting
markdownlint-cli2
is run
!
) and
appended to the command-line arguments before file enumerationmarkdownItPlugins
: Array
of Array
s, each of which has a String
naming a markdown-it plugin followed by parameters
JSONC
file[ [ "plugin-name", param_0, param_1, ... ], ... ]
noInlineConfig
: Boolean
value to disable the support of
HTML comments within Markdown content
<!-- markdownlint-disable some-rule -->
outputFormatters
: Array
of Array
s, each of which has a String
naming a markdownlint-cli2-formatter followed
by parameters
JSONC
file[ [ "formatter-name", param_0, param_1, ... ], ... ]
markdownlint-cli2
is run.markdownlint-cli2.jsonc
with all
properties set.markdownlint-cli2.js
.markdownlint-cli2.jsonc
object described above..markdownlint-cli2.jsonc
described above..markdownlint-cli2.jsonc
file is present in the same directory, it
takes precedence..markdownlint-cli2.js
.markdownlint.jsonc
or .markdownlint.json
markdownlint
config
object.jsonc
and json
files are present in the same directory, the jsonc
version takes precedence.extends
property (documented in the link above)..markdownlint.jsonc
.markdownlint.yaml
or .markdownlint.yml
markdownlint
config
object.jsonc
/json
files described above.yaml
and yml
files are present in the same directory, the yaml
version takes precedence.jsonc
or json
file is present in the same directory, it takes
precedence..markdownlint.yaml
.markdownlint.js
markdownlint
config
object.jsonc
/json
files described above.jsonc
, json
, yaml
, or yml
file is present in the same directory,
it takes precedence..markdownlint.js
markdownlint-cli
INI
config format, .markdownlintrc
, and .markdownlintignore
are not
supported.vscode-markdownlint
.markdownlintrc
and .markdownlintignore
are not supported.markdownlint-cli
markdown-it
plugins.markdownlint-cli2.js
and .markdownlint.js
0.0.7
.markdownlint-cli2.js
and .markdownlint.js
FAQs
A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the `markdownlint` library
The npm package markdownlint-cli2 receives a total of 115,666 weekly downloads. As such, markdownlint-cli2 popularity was classified as popular.
We found that markdownlint-cli2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.