jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.71k stars 3.39k forks source link

HTML validator complaining about "Stray end tag col" with --self-contained option #6295

Closed aubertc closed 4 years ago

aubertc commented 4 years ago

The following temp.md file

| A | B| 
| --- | ---------- |
|  A long, long, long, long, long, long, text. | A long, long, long, long, long, long, text. |

when compiled with

pandoc --self-contained -o temp.html temp.md

produces a table that begins with

<table>
<colgroup>
<col style="width: 23%"></col>
<col style="width: 76%"></col>

which causes e.g. the Nu HTML Checker to complain about

Error: Stray end tag col.

Pandoc 2.9.2.1

Maybe this is documented somewhere, but I could not find where: what is the cause / justification / rationale for this? This error is not present with the -standalone option.

jgm commented 4 years ago

Does it still complain if you change it to

<col style="width: 23%" />
aubertc commented 4 years ago

Nope.

aubertc commented 1 year ago

There is an update, and now it complains with

Info: Trailing slash on void elements has no effect and interacts badly with unquoted attribute values.

From line … <col style="width: 23%" />

This code could be replaced by

<col style="width: 23%">

to comply with this validator.

jgm commented 1 year ago

Well, we try to produce polyglot HTML that is also valid XHTML. That's because we need XHTML for valid EPUBv3. For background see e.g. #5146.

aubertc commented 1 year ago

Thanks a lot for the context, it makes sense.