Can I import epub, converting classes to styles

I wrote a story in Scrivener, compiled to epub (it looked beautiful), loaded it into Sigil to make a few tweaks and soon found myself doing edits all over the place. Now I want to bring the work back into Scrivener for a record as well as use it as part of a larger project.

I’m using the import web page tools to get the files back into Scrivener and it works very well, but, is there a way to convert classes in the HTML to styles in Scrivener? I have looked all over. Worst case, I style all the text with the primary style then go into each ‘chapter’ and hand tool the special paragraphs. Works great, but tedious.


Why not make the edits to the original text and just re-compile? ePub is not really designed to be an editable format.

Are the tweaks to the content, or to the formatting?

Yeah, that would have been the disciplined way to do it, but there are tricks I’m doing in HTML that Scrivener can’t do, so, originally, I was trying to avoid having to recompile and rebuild the epub.

I’m pretty comfortable with HTML and Sigil makes it easy to edit both content and format, so that’s what I’m doing.

I simply want to make sure I’m not missing something that would convert the HTML classes to Scrivener styles, thus saving me a couple hours of work.

Scrivener can recognize styles from Word and Markdown files, but not HTML classes.

On that note, feel free to give us a few examples of what you’re looking to do with the output. You might be surprised at the extent to which you can modify the HTML output with Scrivener! I would say that in most cases you should be able to tweak your compile settings to produce the book you want with a single click, leaving Sigil to serve as a design-oriented tool (where we can benefit from realtime adjustments to the CSS and HTML rather than waste hours recompiling), where design changes can in the end be brought back into the compile settings.

I will say, to the wish request itself, that such isn’t on the table in any form. The main issues would first be: what makes for a good class assignment in the HTML does not necessarily make for a good style assignment in the source material. You may have the setting disabled that produces such clutter, but an obvious example would be books generated with tools set to copy WYSIWYG style formatting as close as possible, which tend to produce very messy output with serialised paragraph and span classes—but even in cases where the structure and design is fundamentally sound, we might have things that make no sense in the source material, or that would be difficult to coalesce into a sensible result.

A simple way of putting it would be to compare output to how Markdown works: you want the source to be only as complex as it needs to be to express intention, while you want the end result to be as complex as it needs to be to implement a design. The two are very different things, and trying to get the designed output back into the source means, in most cases, greatly increasing the complexity of the source beyond what is needed to express intent.

The other hurdle would be how Scrivener’s compile system creates a flattened result from what are multiple data sources. A node in the draft outline has its outline title injected into the output using a template of HTML that generates a numbered chapter heading, and then injects text content as prose below that. How is Scrivener to know, upon importing a flat file with a some apparatus around an h1 and a sequence of p lines, that some of that should be stripped of textual fluff like “Chapter 7<br/>” and inserted back into the outline node, while other parts should go into the text? Even in that extremely simple example it couldn’t presume to do that, but we can do much more than that with the compiler.

Thank you, kewms and AmberV, for your response and analysis. While my needs are specific and structured, I now understand how it’s difficult to generalize this kind of functionality. I just wanted to be sure I hadn’t missed something.

Again, thank you.