← 返回命令列表

Linux command

htmlhint 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Lint HTML file

htmlhint [file.html]

Lint multiple files

htmlhint [*.html]

Use config file

htmlhint -c [.htmlhintrc] [file.html]

Output as JSON

htmlhint --format json [file.html]

Ignore specific patterns

htmlhint --ignore [**/vendor/**] [file.html]

List all available rules

htmlhint --list

Initialize config file

htmlhint --init

说明

HTMLHint is a static code analysis tool for HTML. It checks for common mistakes, deprecated elements, and best practices. The tool enforces consistent HTML style and catches potential issues. It supports custom rules and configuration files.

参数

-c, --config _FILE_
Config file path.
-f, --format _FORMAT_
Output format: default, json, unix, sarif, markdown, junit, html, compact, checkstyle.
-i, --ignore _PATTERN_
Glob patterns of files or folders to ignore.
-r, --rules _RULES_
Rules to enable (comma-separated, e.g., tag-pair,attr-lowercase=true).
-R, --rulesdir _PATH_
Load custom rules from file or folder.
-l, --list
Show all available rules.
--init
Create a new .htmlhintrc config file with default rules.
--nocolor
Disable colored output.
--warn
Warn only, exit with code 0.
-V, --version
Output the version number.
-h, --help
Display help information.

FAQ

What is the htmlhint command used for?

HTMLHint is a static code analysis tool for HTML. It checks for common mistakes, deprecated elements, and best practices. The tool enforces consistent HTML style and catches potential issues. It supports custom rules and configuration files.

How do I run a basic htmlhint example?

Run `htmlhint [file.html]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -c, --config _FILE_ do in htmlhint?

Config file path.