A demo for the htmlSanityCheck Gradle plugin.
Contains a few asciidoc files to show typical semantic errors in html files which HtmlSC checker will detect and report.
Checkout from Github, then invoke the following commands:
gradle htmlSanityCheck
Gradle will download all required libraries, compile the asciidoctor source files into html and invoke the HtmlSC. You’ll find the checking results in
build/reports/htmlchecks/index.html
-
❏ Broken External Links
More precisely, htmlSC looks for missing image files on the local file system, as it currently does NOT support checking of external resources.
(synonym: broken internal links)
Html anchor tags contain href attributes, which denote the link-target where the browser shall jump when the appropriate link is clicked.
Example:
<a href="missing">missing link</a> // (1)
<h1 id="existing">Sample Header</h1> // (2)
<a href="existing"> jump to the sample header</a> //(3)
-
This link tells the browser to jump to a location with
id="missing"
(which is missing in this document…) -
The
id=…
attribute denotes a specific identification for an HTML element. -
This `href`is an existing link target.
HtmlSC does currently not support external link checking. See issue #34
(synonym: duplicate ids)
If a link target (id-attribute) occures more than once, the browser cannot determine where to jump.
Example:
<a href="#dupeTarget">duplicate Target</a> // (1)
<h2 id="dupeTarget">One Header</h2> // (2)
... some text
<h2 id="dupeTarget">Another Header</h2> // (3)
... some more text
-
a link with link-target 'dupeTarget'
-
One header with id 'dupeTarget'
-
Another header with the same id
ImageMaps allow parts of an image to be used as hyperlinks to arbitrary targets.
ImageMaps need two html tags to work: An <img…>
tag plus a <map…>
tag.
See the following example for a correct ImageMap (in html source)
<img src="image.jpg" usemap="#yourmap"> // (1)
<map name="yourmap"> // (2)
<area shape="rect" coords="0,0,1,1" href="#test1"> // (3)
<area shape="circle" coords="0,1,1" href="#test2">
</map>
-
an image (img-tag) with a "usemap" attribute.
-
the actual map, defining a number of click-sensitive
-
areas on the image together with the respective link targets.
Several things could go wrong with ImageMaps
-
referenced map does not exist (wrong usemap or wrong map-name)
-
several maps exists with same name (ambiguous map-name)
-
map not referenced (dangling map)
-
no link-targets in map (empty map)
-
link-target missing in area (empty href in area)
-
broken link targets in map (broken href in area-tag)