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 might need to resolve some named character references #2111

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

Comments

@adamwight
Copy link

If a markdown file in "extras" contains named entities like   then the output xhtml will fail epubcheck with a fatal error:

FATAL(RSC-016): ./ymlr.epub/OEBPS/content/benchmark.xhtml(70,45): Fatal Error while parsing file: The entity "nbsp" was referenced, but not declared.

The w3c validator agrees that this xhtml is invalid, saying

Fatal Error: reference to undeclared general entity nbsp

I can't make out how all the different specifications intersect here, but it makes sense that epub reading systems might only support a limited subset of all named character references. XML with no entity modules has only a handful of named entities,   is defined in HTMLlat1, and at the other end of the scale, current recommendations are to pull in the htmlmathml-f entities.

Since EPUB can't reach out to external resources, in order to support named entities it seems that a fully-compliant epub container would have to either inline this entity set (if this is allowed?), or embed only the necessary entities literally.

Another simpler alternative to shipping named entities would be to resolve all named character references into the numeric form, ie.   ->  .

@josevalim
Copy link
Member

It seems we would have to include that list per page, which would be quite verbose. Perhaps the best is to provide indeed a custom rendering of XHTML, alongside #2112.

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