Skip to content

Headings: HTML5 vs HTMLBook #215

@dac514

Description

@dac514

We hope to start using HTMLBook in a WordPress application where everything in between <div class="content"> tags is generated by WordPress.

This document is valid HTML5:

<!DOCTYPE html>
<head>
    <title>HTMLBook Sample</title>
    <meta name="HTMLBook Sample" content="text/html; charset=utf-8"/>
</head>
<body data-type="book" class="book" id="htmlbook">
<section data-type="chapter">
    <header>
        <h1>HTMLBook</h1>
    </header>
    <div class="content">
        <h1>WordPress Post</h1>
        <p>The User Is Doing Things</p>
        <h1>WordPress Post</h1>
        <p>The User Is Doing Things</p>
    </div>
</section>
</body>
</html>

(Tested here: https://html5.validator.nu/)

The same document with an extra:

<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	  xsi:schemaLocation="http://www.w3.org/1999/xhtml ../schema/htmlbook.xsd"
	  xmlns="http://www.w3.org/1999/xhtml">

In the header is not valid HTMLBook. It complains about the second <h1>

element h1: Schemas validity error : Element '{http://www.w3.org/1999/xhtml}h1': This element is not expected."

I understand why it is invalid in HTMLBook but... the HTML5 spec "encourages" authors to use "headings of the appropriate rank" instead of h1 everywhere. An encouragement is not a normative requirement.

Is there something we can do to loosen the headings validation between a given div tag?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions