NormalizeScrivEpub

 

A Sigil Plugin


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.0"

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 with my own Scrivener conversions to epub. This plugin should only be used with Scrivener-generated epubs and does the following:

* 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 and replace it with another more stylish standard TOC(Level 1 only).

* 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 the 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 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 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 then the p tag to h1 tag transformation will be prevented.(added in v0.1.1) . The default setting for this property is true.

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 on your epub in Sigil after running this plugin.

* The scriv epub must always contain a TOC file(contents.xhtml) generated by Scrivener, otherwise the plugin will fail.

* Please also ensure that 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 probemtic 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 finish off the epub as described above. Second, this plugin will transform all major headings formatted as p tags to heading 1 style and will also create a better TOC. The 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).