Epub3 stylesheet link compatible with kindlegen #5466
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It’s seems that the commit daamien@411119b removes the
type="text/css"
from both<style>
and<rel="stylesheet">
elements in all templates. The rationale for the change is described in #5146 — the elements are optional and can cause HTML validators to complain.However, this change causes Amazon’s Kindlegen (MAC OSX V2.9 build 1028-0897292) to not pick up the stylesheet when converting a Pandoc generated ePub3 to Mobi. No styles! This is probably a bug on Amazon’s end 😳—Epub3 uses XHTML5, so I think the type attribute should indeed be optional. But it is probably much easier reverting the change at Pandoc’s end, at least for the epub3 template.
One can verify the issue by running the Toy example from Pandoc’s documentation, then running
kindlegen mybook.epub
and then usekindleunpack.py mybook.mobi
. You will find the default pandoc stylesheet not to be included. I could work around the issue by copying pandoc’s epub3 template and adding the attribute to the link tag. I suggest doing this change in the default template.Whether or not I added the type attribute had no effect on the inline
<style>
tag which Pandoc places in the header by default—these get added regardless, as separate stylesheets for each page. Since the validators mentioned by @crystalfp in #5146 complained only about the<style>
tag, and only in the context of standalone HTML5, it seems save to suggest that adding thetype
attribute only to the link tag of the epub3 template is not very intrusive.BTW I wonder why is there an inline style tag in the epub template, these could be part of the default css right?