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 with multiple --css causes duplicate IDs in content.opf #5463

Closed
nybblr opened this issue Apr 23, 2019 · 1 comment
Closed

EPUB with multiple --css causes duplicate IDs in content.opf #5463

nybblr opened this issue Apr 23, 2019 · 1 comment

Comments

@nybblr
Copy link

nybblr commented Apr 23, 2019

To reuse styling between my web and epub versions, I split up my styling into several files and add them with --css:

pandoc \
  -f json \
  --standalone \
  --css publish/fonts.css \
  --css publish/typography.css \
  --css publish/highlight.css \
  -o build/book.epub \
  ...

I'm using Pandoc 2.7.2. The resultant content.opf file has this:

    <item id="style" href="styles/stylesheet1.css" media-type="text/css" />
    <item id="style" href="styles/stylesheet2.css" media-type="text/css" />
    <item id="style" href="styles/stylesheet3.css" media-type="text/css" />

The ePub opens fine in Calibre/iBooks, but since each stylesheet gets the same ID of style, it ticks off validators and is causing conversion to MOBI to fail for Kindle readers.

Is --css meant to be used multiple times in this way? Would it be enough to generate unique ids, or do the stylesheets need to be concatenated?

I thought I'd be clever and use a named pipe to concatenate them first, but apparently it interferes with processing a JSON AST from stdin.

process-that-generates-json-ast | pandoc \
  -f json \
  --standalone \
  --css <(cat publish/{fonts,typography,highlight}.css) \
  -o build/book.epub \
  -
@jgm
Copy link
Owner

jgm commented Apr 23, 2019

Yes, --css is meant to be usable in this way. The duplicate style is probably leftover from when we only allowed one CSS file. I can fix.

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

No branches or pull requests

2 participants