README.md in html-proofer-1.2.1 vs README.md in html-proofer-1.3.0
- old
+ new
@@ -2,11 +2,11 @@
If you generate HTML files, _then this tool might be for you_.
`HTML::Proofer` is a set of tests to validate your HTML output. These tests check if your image references are legitimate, if they have alt tags, if your internal links are working, and so on. It's intended to be an all-in-one checker for your output.
-[![Build Status](https://travis-ci.org/gjtorikian/html-proofer.png?branch=master)](https://travis-ci.org/gjtorikian/html-proofer) [![Gem Version](https://badge.fury.io/rb/html-proofer.png)](http://badge.fury.io/rb/html-proofer)
+[![Build Status](https://travis-ci.org/gjtorikian/html-proofer.svg?branch=master)](https://travis-ci.org/gjtorikian/html-proofer) [![Gem Version](https://badge.fury.io/rb/html-proofer.svg)](http://badge.fury.io/rb/html-proofer)
## Installation
Add this line to your application's Gemfile:
@@ -56,11 +56,11 @@
HTML::Proofer.new("./out").run
```
### Using on the command-line
-You'll get a new program called `htmlproof` with this gem. Jawesome!
+You'll get a new program called `htmlproof` with this gem. Terrific!
Use it like you'd expect to:
``` bash
htmlproof run ./out --swap wow:cow,mow:doh --ext .html.erb --ignore www.github.com
@@ -88,10 +88,18 @@
```bash
htmlproof ./_site
```
+### Real-life examples
+
+Project | Repository
+:--- | :---
+[Raspberry Pi documentation](http://www.raspberrypi.org/documentation/) | [raspberrypi/documentation]( https://github.com/raspberrypi/documentation)
+[Open Whisper Systems website](https://whispersystems.org/) | [WhisperSystems/whispersystems.org](https://github.com/WhisperSystems/whispersystems.org)
+[Jekyll website](http://jekyllrb.com/) | [jekyll/jekyll](https://github.com/jekyll/jekyll)
+
## What's Tested?
### Images
`img` elements:
@@ -122,22 +130,35 @@
| :----- | :---------- | :------ |
| `disable_external` | If `true`, does not run the external link checker, which can take a lot of time. | `false` |
| `ext` | The extension of your HTML files including the dot. | `.html`
| `favicon` | Enables the favicon checker. | `false` |
| `followlocation` | Follows external redirections. Amends missing trailing slashes to internal directories. | `true` |
-| `as_link_array` | Assumes that you've passed in just an array of links to check. | `false` |
+| `directory_index_file` | Sets the file to look for when a link refers to a directory. | `index.html` |
| `href_ignore` | An array of Strings or RegExps containing `href`s that are safe to ignore. Certain URIs, like `mailto` and `tel`, are always ignored. | `[]` |
| `alt_ignore` | An array of Strings or RegExps containing `img`s whose missing `alt` tags are safe to ignore. | `[]` |
| `href_swap` | A hash containing key-value pairs of `RegExp => String`. It transforms links that match `RegExp` into `String` via `gsub`. | `{}` |
| `verbose` | If `true`, outputs extra information as the checking happens. Useful for debugging. | `false` |
+| `only_4xx` | Only reports errors for links that fall within the 4xx status code range. | `false` |
You can also pass in any of Typhoeus' options for the external link check. For example:
``` ruby
-HTML::Proofer.new("out/", {:ext => ".htm", :verbose = > true, :ssl_verifyhost => 2 })
+HTML::Proofer.new("out/", {:ext => ".htm", :verbose => true, :ssl_verifyhost => 2 })
```
This sets `HTML::Proofer`'s extensions to use _.htm_, and gives Typhoeus a configuration for it to be verbose, and use specific SSL settings. Check [the Typhoeus documentation](https://github.com/typhoeus/typhoeus#other-curl-options) for more information on what options it can receive.
+
+Instead of a directory as the first argument, you can also pass in an array of links:
+
+``` ruby
+HTML::Proofer.new(["http://github.com", "http://jekyllrb.com"])
+```
+
+This configures Proofer to just test those links to ensure they are valid. Note that for the command-line, you'll need to pass a special `--as-links` argument:
+
+``` bash
+bin/htmlproof www.google.com,www.github.com --as-links
+```
## Ignoring content
Add the `data-proofer-ignore` attribute to any tag to ignore it from the checks.