asciidoctor / asciidoctor-epub3

:blue_book: Asciidoctor EPUB3 is a set of Asciidoctor extensions for converting AsciiDoc to EPUB3
https://asciidoctor.org
MIT License
216 stars 67 forks source link

Add XML declarations #424

Closed abbrev closed 2 years ago

abbrev commented 2 years ago

This is recommend by the XHTML spec. See https://www.w3.org/TR/xhtml11/conformance.html:

XHTML document authors SHOULD use XML declarations in all their documents.

The "Send to Kindle" feature also seems to require this XML declaration (otherwise non-ASCII characters in the HTML, like em dash and curly quotes, get mangled).

Also remove <meta charset="UTF-8"> lines as those are now redundant.

This change works on the five different Android and Linux EPUB readers that I tested:

mojavelinux commented 2 years ago

In looking at the latest EPUB 3 spec again, it seems like they have now reverted to stating that content documents are XHTML. As far as I remember, that didn't used to be the case.

Checking readers is one thing, but this change needs to pass the epub3 validator. If it does, I don't see any problem with applying it.

slonopotamus commented 2 years ago

this change needs to pass the epub3 validator

We validate the whole sample book in tests and it happily passed on CI.

There are some issues on Windows, but I believe they are unrelated to current PR.