The function causes CSS HTML Validator to generate a message that extracts and shows the heading text every time the "h1" heading tag is used.
You can also add functions for the other HTML heading elements as well (h2, h3, h4, etc). For example, use a function named onEndTag_h2() to generate a message every time the "h2" heading element is used.
Just save the function in a text file with a txt of cfg file extension and specify the filename in the Config File options page in the Validator Engine Options (Ctrl+F4). Be sure to reload the configuration so that the script takes effect.
Code: Select all
function onEndTag_h1() {
Message(1, MSG_MESSAGE, 'h1 heading text: '+getValueString(33), getLocation(3,0));
}
Code: Select all
function onEndTag_h1() {
Message(1, MSG_MESSAGE, 'h1 heading text: '+getValueString(33), getLocation(3,0));
}
function onEndTag_h2() {
Message(1, MSG_MESSAGE, 'h2 heading text: '+getValueString(33), getLocation(3,0));
}
Code: Select all
function onEndTag_h1() {
MessageEx(5, 2017100300, MSG_MESSAGE, 'H1 Heading Text', 'h1 heading text: '+getValueString(33), getLocation(3,0));
}
For more about what you can do with scripting in CSS HTML Validator, visit:
https://www.htmlvalidator.com/current/d ... l?tnpl.htm