HTMLProofe(1)
πΈ htmlproofer(1) πΈ
okay bestie, welcome to the User commands corner of your manual, section 1, and the star of the show is htmlproofer. she's here, she's ready, and she's gonna validate your HTML like it's her whole personality. π
β¨ NAME β¨
htmlproofer β validate rendered HTML files π
π¦ SYNOPSIS π¦
htmlproofer directory [options]
π DESCRIPTION π
so htmlproofer is literally a whole set of tests to validate HTML output. these tests check if image references are legitimate, if they have alt tags, if internal links are working, and so on. HTMLProofer can run on a file, a directory, an array of directories, or an array of links. below is a mostly comprehensive list of checks that it can perform, and yes she ate. π₯
Images (<img> elements)
- Whether all images have alt tags
- Whether internal image references are not broken
- Whether external images are showing
- Whether images are HTTPS
Links (<a>, <link> elements)
- Whether internal links are working
- Whether internal hash references (
#linkToMe) are working - Whether external links are working
- Whether links are HTTPS
- Whether CORS/SRI is enabled
Scripts (<script> elements)
- Whether internal script references are working
- Whether external scripts are loading
- Whether CORS/SRI is enabled
Favicon
- Whether favicons are valid.
OpenGraph
- Whether the images and URLs in the OpenGraph metadata are valid.
HTML
- Whether your HTML markup is valid.
This is done via Nokogiri to ensure well-formed markup.
π OPTIONS π
listed below are the command line options for htmlproofer, and bestie there are a LOT of them, so buckle up, we're going through every single one no cap:
--allow-missing-hrefβ don't flag tags missing anhrefattribute. this is the default for HTML5.--allow-hash-hrefβ ignoreshref="#".--as-linksβ assumes that PATH is a comma-separated array of links to check.--alt-ignore image1,[image2,...]β a comma-separated list of Strings or RegExps containing images whose missing alt attributes are safe to ignore.--assume-extensionβ automatically add extension (e.g..html) to file paths, to allow extensionless URLs (as supported by Jekyll 3 and GitHub Pages).--checks-to-ignore check1,[check2,...]β an array of Strings indicating which checks not to perform.--check-external-hashβ checks whether external hashes exist (even if the webpage exists). this slows the checker down. π--check-faviconβ enables the favicon checker.--check-htmlβ enables HTML validation errors from Nokogiri.--check-img-httpβ check, that images use HTTPS.--check-opengraphβ enables the Open Graph checker.--check-sriβ check that<link>and<script>external resources do use SRI.--directory-index-file filenameβ sets the file to look for when a link refers to a directory. defaults toindex.html.--disable-externalβ don't run the external link checker, which can take a lot of time. she's saving you from the waiting game fr fr.--empty-alt-ignoreβ if true, ignores images with empty alt attribues.--error-sort sortβ defines the sort order for error output. can be:path,:desc, or:status. defaults to:path.--enforce-httpsβ fails if a link is not marked as HTTPS.--extension extβ the extension of HTML files including the dot. defaults to.html.--external_onlyβ only check for problems with external references.--file-ignore file1,[file2,...]β a comma-separated list of Strings or RegExps containing file paths that are safe to ignore.--helpβ print this usage information on the command line.--http-status-ignore 123,[xxx, ...]β a comma-separated list of numbers representing status codes to ignore.--internal-domains domain1,[domain2,...]β a comma-separated list of Strings containing domains that will be treated as internal urls.--report-invalid-tagsβ ignore errors from--check-htmlassociated with unknown markup.--report-missing-namesβ ignore errors from--check-htmlassociated with missing entities.--report-script-embedsβ ignore errors from--check-htmlassociated with<script>s.--log-level levelβ sets the logging level, as determined by Yell. one of:debug,:info,:warn,:error, or:fatal. defaults to:info.--only-4xxβ only reports errors for links that fall within the 4xx status code range--storage-dir directoryβ directory where to store the cache log. defaults totmp/.htmlproofer.--timeframe timeβ a string representing the caching timeframe.--typhoeus-config stringβ JSON-formatted string of Typhoeus config. it will override the html-proofer defaults.--url-ignore link1,[link2,...]β a comma-separated list of Strings or RegExps containing URLs that are safe to ignore. it affects all HTML attributes. non-HTTP(S) URIs are always ignored.--url-swap re:string,[re:string,...]β a comma-separated list containing key-value pairs of RegExp => String. it transforms URLs that match RegExp into String via gsub. the escape sequences\:should be used to produce literal:s.'
π Special usage cases π
for options which require an array of input, values can be surrounded by quotes. don't use any spaces. for example, to exclude an array of HTTP status code:
htmlproofer --http-status-ignore 999,401,404 ./out
for options like --url-ignore, which require an array of regular expressions, the following syntax works:
htmlproofer --url-ignore /www.github.com/,/foo.com/ ./out
the --url-swap switch is a bit special, since one will pass in a pair of RegEx:String values. the escape sequences \: should be used to produce literal :. htmlproofer will figure out what you mean. she's smart like that. π§
htmlproofer --url-swap wow:cow,mow:doh --extension .html.erb --url-ignore www.github.com ./out
π AUTHORS π
the program author is Garen Torikian.
this manual page page was written by Daniel Leidert <daniel.leidert@wgdd.de> for the Debian distribution (but may be used by others).
okay that's the whole vibe, bestie π«Ά this is HTMLProofe(1) from 2019-03-24, and you just read the entire thing, main character energy fr. go forth and validate. periodt. πβ¨π
π¦ where this page comes from
- debian bookworm: ruby-html-proofer 3.19.2-7 Β· MIT
- debian trixie: ruby-html-proofer 3.19.4-2 Β· MIT
- ubuntu jammy: ruby-html-proofer 3.14.1-2 Β· MIT
- ubuntu noble: ruby-html-proofer 3.19.4-1 Β· MIT
- ubuntu resolute: ruby-html-proofer 3.19.4-2 Β· MIT
- ubuntu stonking: ruby-html-proofer 5.2.2-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms