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

Allow overriding chapter header look-and-feel #41

Closed
mraible opened this issue Oct 28, 2015 · 6 comments
Closed

Allow overriding chapter header look-and-feel #41

mraible opened this issue Oct 28, 2015 · 6 comments
Assignees

Comments

@mraible
Copy link

mraible commented Oct 28, 2015

I'd like change the chapter headers to use a bold font and a white background, instead of a dark background with white text. I'd also like to remove the icon and author name.

Is this possible?

If not, why is the current look-and-feel recommended?

@mojavelinux
Copy link
Member

Changing the style and layout of the EPUB output is as simple as customizing the stylesheet. In fact, an EPUB is really just a webpage. Copy the the CSS from this repository into a local directory (e.g., epub3-styles) and pass the following flag:

-a epub3-stylesdir=epub3-styles

By default it will look for the following two files:

  • epub3.css
  • epub3-css3-only.css

The second file can be empty, but gives you the opportunity to add styles that are only understood by CSS3-compliant readers (anything based on Webkit).

The current styles are just a default theme. They were designed with a specific use case in mind. I have plans to make them more generic now that the CSS can be replaced.

@mraible
Copy link
Author

mraible commented Oct 28, 2015

Thanks @mojavelinux - I'll give this a try. On a related note, is it possible to add the table of contents to the epub version? I realize it's embedded and visible in the reader, but my publisher is asking if it can be included in the body of the document. I've attached a screenshot of where I see it in the reader.
epub-toc

@mojavelinux
Copy link
Member

We did not include the TOC in the document since all ereaders have a built-in TOC capabilities. If you wanted to add it into the document itself, you'd need to override methods in the converter like you did for Asciidoctor PDF. Although there's no dedicated method in Asciidoctor EPUB3, the method mark_last_paragraph might give you the right opportunity to insert it.

Having said that, I encourage you to challenge InfoQ on this one because it's completely illogical to put a TOC in the flow of the content for EPUB3. That goes against the recommendations of the EPUB3 working group and is a really bad user experience. All ereaders have a built-in TOC for good reason. Honoring this recommendation is critical to accessibility as well.

@mojavelinux mojavelinux added this to the support milestone Oct 29, 2015
@mraible
Copy link
Author

mraible commented Oct 29, 2015

Thanks! I was able to successfully customize things using epub3-stylesdir. I'm curious - do I need to copy all CSS rules into my epub3.css, or only the ones I want to override?

@mraible mraible closed this as completed Oct 29, 2015
@mojavelinux
Copy link
Member

It's all or nothing atm, so you'll want to copy them all. We should implement something like stylesheet that allows you to pass in additional styles, but that's not implemented yet.

@mojavelinux mojavelinux self-assigned this Oct 29, 2015
@mojavelinux
Copy link
Member

I've opened an issue to document how to provide your own styles in the README. See #43.

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

No branches or pull requests

2 participants