Reformats and normalizes Scrivener epubs
Requirements
Plugin Type: Edit
Minimum Sigil requirement: v0.9.3 or higher
Python Requirements: Python 3.4+ (Bundled or External)
OS Requirements: Windows, Linux or OSX
*** Tested on Windows 7, 8 & 10 only ***
Current Version: "0.1.3"
Installation
* Select
Manage Plugins from the
Plugins menu. In the dialog box, select either the Bundled Python or the External Python(Python 3.4+ should be installed on your computer to run this plugin externally).
* Click
Add Plugin and select
NormalizeScrivEpub_vXXX.zip. This will load and install the plugin into Sigil, which you can then select and run the plugin by selecting
Plugins > Edit > NormalizeScrivEpub.
Description
This simple edit plugin addresses some of the niggles I've had in the past with my own Scrivener conversions to epub. This plugin should only be used with Scrivener-generated epubs and does the following:
* Optionally converts the styling of all main headings(which are all formatted with <p> tags in Scrivener epubs) to <h1> tags.
* The user can also directly format the new <h1> tags from plugin prefs to more easily pre-style the new headings in the epub before running the plugin.
* The plugin will also automatically remove Scrivener's TOC file(contents.xhtml) and replace it with another more stylish standard TOC(Level 1 only).
* Reformats all ebook image dimensions as percentages of screen height/width. This will ensure correct display of smaller images across all epub ereaders and KF8 devices(added in v0.1.2). If specifically uploading to Kindle then the
AddKindleMediaQueries plugin should also be run on the epub(for Kindle uploads only) to ensure that all smaller ebook images are correctly dual formatted for proper display across all KF8 and older KF7(mobi7) Kindle devices.
* A new toc css file will also be created in the epub.
* Converts all epub text and headings to default serif throughout.
* Formats all epub links in standard blue with underline.
* Adds globals and presets to
stylesheet.css to help avoid Look Inside issues on KDP upload.
Adjusting Heading 1 Style
If required, you can pre-style and change the default
set_h1_style properties in plugin prefs before you run the plugin. Or you can simply re-style h1 in the main stylesheet after you run the plugin. The default prefs for this plugin looks like this:
{
"set_h1_style": "h1 {\nfont-size: 1.167em;\nfont-weight: bold;\ntext-align: center;\ntext-indent: 0em;\n}\n",
"add_h1_tags": true
}
The
add_h1_tags option allows the user to completely control heading 1 formatting. If set to
true, heading p tags will be converted to h1 tags and the appropriate h1 styling will be added to the css. If set to
false by the plugin user then the p tag to h1 tag transformation will be prevented. The default setting for this property is
true.(added in v0.1.1)
Caveat
* Make sure that you run this plugin directly after conversion to epub from Scrivener otherwise you may have problems i.e do any manual formatting/changes to your epub in Sigil after running this plugin.
* Please also ensure that all internal links are appropriately formatted in your epub before you run this plugin, otherwise heading duplications or other problems might occur in the new epub after you run this plugin.
* All table styling will be removed from the epub stylesheet. It's perhaps better and easier(less probematic for vendor upload conversions) if you convert your tables to compressed jpeg images first and then add them as images to your scriv doc before conversion to epub.
Plugin Run
First load your epub into Sigil, set the h1 styling that you want in plugin prefs, then just run the plugin.
I'm not really sure how useful this plugin will be to Scrivener epubbers. It does two main tasks. First, I use this plugin to more quickly reformat and properly finish-off the epub as described above. Second, this plugin can optionally transform all major headings formatted with p tags to h1 tags and will also create a better TOC. The real purpose of doing this is to allow scriv epubbers to use more Sigil plugins that depend on h1 headings for proper operation(like some of my other plugins).
Changes:
Spoiler:
v0.1.3
-- Fixed a bug caused by an incorrect css id in the opf file.
v0.1.2
-- Added functionality. Now reformats all ebook image dimensions as percentages of screen width/height. See Description for more details.
v0.1.1
-- Added functionality. The user now has a prefs option to completely control the transformation of p tag headings to h1 styled headings. See release notes -- Adjusting Heading 1 Style -- for details
v0.1.0
-- Initial release