Repository navigation
Epub3 stylesheet link compatible with kindlegen - #5466
Merged
Merged
Conversation
daamien/pandoc@411119b removes `type="text/css"` from both `<style>` and `<rel="stylesheet">` elements in all templates. However, Amazon’s kindlegen software relies on this attribute on `<link>` elements when detecting stylesheets to include.
Owner
|
Thanks. I think it would make sense to move the inline style to the default stylesheet, too. |
jgm
added a commit
that referenced
this pull request
May 4, 2019
Those who use a custom CSS stylesheet with EPUB should
add these lines:
```css
code{ white-space: pre-wrap; }
span.smallcaps{ font-variant: small-caps; }
span.underline{ text-decoration: underline; }
q { quotes: "“" "”" "‘" "’"; }
div.column{ display: inline-block; vertical-align: top; width: 50%; }
```
See #5466.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.epuband 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 thetypeattribute 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?