With the new doctype and elements that are part of HTML5, how do you get xdmp:tidy()
to recognize those in HTML5?
If I have an html page that contains something like:
<!DOCTYPE html>
<html>
<header>blah</header>
<section>blah</section>
and then try something like:
xdmp:tidy(xdmp:document-get("home.html"))
I get errors like:
<section> is not recognized! discarding unexpected <section>
<header> is not recognized! discarding unexpected <header>
Are there some options I can send to xdmp:tidy()
to get it to handle it?
Try using the new-blocklevel-tags option that specifies the new HTML5 tags. You can include multiple elements by separating them with a comma or space. You should get the expected output with no errors, but there will still be warnings.
Try this in cq:
xdmp:tidy(xdmp:document-get("home.html"), <options xmlns="xdmp:tidy"><new-blocklevel-tags>header section</new-blocklevel-tags></options>)
Click here for a good reference about adding various tags (block level, inline, empty) that should work as options in xdmp:tidy. The same information is here, but it's a bit harder to get to, there's so many options!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With