Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

epub formatter allows non-conformant HTML comments #2112

Open
adamwight opened this issue Apr 6, 2025 · 1 comment
Open

epub formatter allows non-conformant HTML comments #2112

adamwight opened this issue Apr 6, 2025 · 1 comment

Comments

@adamwight
Copy link

adamwight commented Apr 6, 2025

When repackaging Markdown HTML as XHTML to build an EPUB, some changes have to be made to html comments like this:

<!--------------------- Don't add new entries after this line --------------------->

This is valid HTML, but XHTML disallows -- inside of a comment.[1]

epubcheck will emit a fatal-level error when parsing such content:

ERROR(RSC-005): ymlr.epub/OEBPS/content/changelog.xhtml(-1,-1): Error while parsing file: The string "--" is not permitted within comments.

It's not entirely clear if ex_doc should be responsible for this, but it would possibly be surprising to markdown documentation authors to find that XHTML constraints will be applied to their content, so maybe we enhance ExDoc.DocAST.to_string({:comment, _attrs, inner, _meta} to replace this illegal sequence with \-\-, &#45;&#45; or whatever.

If nothing is done to work around this in code, it would be polite to warn documentation authors about this and other XHTML constraints in ex_doc docs.

@josevalim
Copy link
Member

Great find. Perhaps we should remove comments when emitting the markdown or, at least, when emitting XHTML?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants