Skip to main content

Command line interface

Usage

$ markuplint target.html
$ markuplint target.html target2.html
$ markuplint "**/*.html"

The CLI takes target HTML files as variadic arguments. Or it accepts glob formats.

It returns the exit code 0 when it succeeded. And returns 1 if the result has problems one or more.

Options

Long OptionShort OptionArgumentDefaultDescription
--config-cFile pathnoneA configuration file path
--fixnonenonefalseFix target files if the rule supports.
--format-fJSON, Simple, GitHub or StandardStandardSelect output format.
--no-search-confignonenonefalseNo search a configure file automatically.
--ignore-extnonenonefalseEvaluate files that are received even though the type of extension.
--no-import-preset-rulesnonenonefalseNo import preset rules.
--localenoneLanguage code (example: en)OS settingLocale of the message of violation.
--no-colornonenonefalseOutput no color.
--problem-only-pnonefalseOutput only problems.
--allow-warningsnonenonefalseReturn status code 0 even if there are warnings.
--no-allow-empty-inputnonenonefalseReturn status code 1 even if there are no input files.
--show-confignoneempty, detailsnoneOutput computed configuration of the target file.
--verbosenonenonefalseOutput with detailed information.
--include-node-modulesnonenonefalseInclude files in node_modules directory.
--severity-parse-errornoneerror, warning or offerrorSpecifies the severity level of parse errors.
--max-countnoneNumber0Limit the number of violations shown. 0 means no limit.
--max-warningsnoneNumber-1Number of warnings to trigger nonzero exit code. -1 means no limit.

Particular run

--help

Show help. (Short option: -h)

--version

Show installed version. (Short option: -v)

--init

Initialization; Create a configuration file and install dependencies.

$ npx markuplint --init

Answer questions interactively. Then it installs modules needed.

--max-count

Limit the number of violations shown in the output. When the limit is reached, remaining files are skipped and marked as "skipped" in the output. This option is particularly useful when introducing Markuplint to existing projects with many violations, as it helps manage overwhelming output and improves performance.

# Show only the first 10 violations
$ markuplint "**/*.html" --max-count=10

# Show only the first violation
$ markuplint index.html --max-count=1

# No limit (default behavior)
$ markuplint index.html --max-count=0

Key features:

  • Performance optimization: Stops rule execution once the limit is reached, improving performance on large projects
  • Gradual adoption: Allows incremental improvement by focusing on a manageable number of issues
  • Information display: Shows an informational message when violations are truncated (in standard format only)
  • Format compatibility: Works seamlessly with all output formats (--format=json, --format=simple, etc.)
  • Fix compatibility: When used with --fix, the limit is ignored to ensure complete fixes

Usage example for gradual improvement:

  1. Run with current violations: markuplint "**/*.html" | wc -l to count current violations
  2. Set limit: markuplint "**/*.html" --max-count=50 in your CI
  3. Fix violations gradually and reduce the limit over time
  4. Eventually remove the limit when all violations are fixed

Note: Files that are skipped due to the limit will be marked as "skipped" in the output, making it clear which files were not processed.

--max-warnings

Set a limit on the number of warnings. If the number of warnings exceeds the specified limit, Markuplint will exit with a non-zero exit code. This option is particularly useful for gradual adoption of Markuplint in existing projects.

# Allow up to 10 warnings
$ markuplint "**/*.html" --max-warnings=10

# No warnings allowed (strict mode)
$ markuplint index.html --max-warnings=0

# No limit (default behavior)
$ markuplint index.html --max-warnings=-1

Key features:

  • Gradual adoption: Allows incremental improvement by setting warning thresholds
  • Cross-file aggregation: Counts warnings across all processed files
  • CI integration: Perfect for setting warning limits in continuous integration
  • Error precedence: Errors always cause non-zero exit code regardless of warning limit

Usage example for gradual improvement:

  1. Check current warnings: markuplint "**/*.html" --allow-warnings to see all warnings
  2. Set initial limit: markuplint "**/*.html" --max-warnings=50 in your CI
  3. Gradually reduce warnings and lower the limit over time
  4. Eventually reach zero warnings with --max-warnings=0