1. Products
  2.   HTML
  3.   Ruby
  4.   HTMLProofer

Free Ruby Library for HTML Documents Validation & Quality

Open Source PHP Library for Performing HTML Validation. It allows Link Validation, Accessibility Testing, Customizable Rules, Parallel Processing, and so on.

In the dynamic world of web development, ensuring the quality and integrity of your HTML code is crucial. Broken links, inaccessible images, and other HTML errors can result in a poor user experience and adversely affect your website's performance. To streamline this process, developers often rely on automated tools and libraries. One such library is HTMLProofer, a robust Ruby gem that assists in validating HTML documents and detecting potential issues.

HTMLProofer is an open source Ruby library that performs HTML validation by checking HTML documents against a set of customizable rules. It uses the HTMLProofer library to parse HTML and CSS, making it highly effective in identifying various types of errors, including broken links, accessibility issues, and other common HTML problems. It acts as a valuable quality assurance tool, enabling developers to identify and fix issues before they impact end-users.

HTMLProofer is very easy to handle and offers flexibility by allowing developers to define their own set of rules. They can specify which issues to ignore or flag, depending on their project requirements. It can detect missing alt attributes, improper heading structures, and other accessibility-related issues, allowing developers to improve the accessibility of their websites. Whether you are building a small website or a large-scale application, by incorporating the library into your development workflow, you can save time, improve the quality of your code, and deliver a seamless browsing experience to your users.

Previous Next

Getting Started with HTMLProofer

The recommended and easiest way to install HTMLProofer is using RubyGems, the dependency management tool for Ruby. Please use the following command a smooth installation.

$ gem install html-proofer

$ gem install HTMLProofer

You can also install it manually; download the latest release files directly from GitHub repository.

HTML Validation inside Ruby Apps

The open source HTMLProofer library has included support for performing HTML validation by checking HTML documents against a set of customizable rules. By employing the power of Nokogiri, an HTML parsing and searching library, the library validates your HTML against industry standards, detecting malformed tags, mismatched attributes, and other HTML syntax errors. It utilizes parallel processing, which significantly improves performance when validating large sets of HTML files. By distributing the validation tasks across multiple CPU cores, it reduces the overall processing time, allowing developers to validate their code swiftly. The library has its own reporting mechanism to print errors at the end of the run.

How to Perform HTML Validation inside Ruby Applications?

require "html-proofer"
require "html/pipeline"
require "find"

# make an out dir
Dir.mkdir("out") unless File.exist?("out")

pipeline = HTML::Pipeline.new([
gfm: true)

# iterate over files, and generate HTML from Markdown
Find.find("./docs") do |path|
  next unless File.extname(path) == ".md"
  contents = File.read(path)
  result = pipeline.call(contents)

  File.open("out/#{path.split("/").pop.sub(".md", ".html")}", "w") { |file| file.write(result[:output].to_s) }

# test your out dir!

How to Perform Link Validation via Ruby API

The open source HTMLProofer library invaluable tool for any web developer striving for error-free HTML code. Its extensive set of validation checks ensures that your website's HTML is well-formed and links are functional. The library excels at validating links within HTML documents. It scans all the links and ensures they are not broken or inaccessible, which helps to maintain a seamless user experience. It can detect various issues, such as missing or incorrect URLs, broken redirects, and links to non-existent pages.