If you’re using Scrivener 3 then I’d say you already have a good option for exporting clean HTML: Markdown. And I don’t by that mean you have to adopt writing in Markdown style as you work (though you certainly can if you want—there are whole systems in the compiler built around that workflow), I mean you can throw a switch in any of the MultiMarkdown or Pandoc based file types at the bottom of the Compile For menu and take full advantage of these technical formats and HTML5 compliant outputs without using a single shred of Markdown in your writing. You’ll find the conversion to be quite comprehensive, and the ability to plug gaps with Styles making it perhaps 99.9% complete.
You can give it a 5-minute test run without any modification to your current settings or work:
- Select Compile For: MultiMarkdown → Web Page (.html).
- Click on the General Options tab on the left hand (gear button) and enable, Convert rich text to MultiMarkdown.
- For your Compile Format, I’d recommend sticking with the stock “Basic MultiMarkdown”, at least as a starting point. You don’t need much glitter and fireworks with this workflow, seeing as how it is purely semantic. There’s no picking out fonts or choosing from myriad design options: you’re just getting
elements anyway, right?
- Assign your section types to layouts based on the simple premise of whether or not they need hierarchical headings (h1 – 6).
- Click Compile and give that an audit against the original.
I’d say the main thing to be looking for are WYSIWYG conventions you’ve done in the editor that aren’t coming through. Since you mention wanting pretty basic HTML though, I’m guessing this may just be all you need to do. But, if you do realise there were some things here and there you were relying upon the HTML engine to handle (maybe you put headings in the text instead of using the compiler to generate heading structure for instance), then you may need to do a little style-based work.
Headings, incidentally, are easy. I’m assuming if work with headings in the text, you’ve already set them up to use Format ▸ Paragraph ▸ HTML Level settings (and with our built-in “Heading 1” and “Heading 2” styles they will be that way by default)—if so then you’re done. The MMD conversion engine will turn those into “##” style Markdown headings, which of course then gets converted straight back to “h2” or whatnot. If not, it’s a simple fix to get the style updated with that setting centrally.
If you’ve used our stock styles for the basics, like block quotes, or captions under images, then you’ll find most things work as you’d expect, and perhaps better than you’ve experienced from Scrivener before for that matter.
But if for example you have a special style you use that colours text red (or whatever), you won’t see that coming through by default. For Scrivener to convert the text to Markdown, there has to be a thing in Markdown that does “red text”. If there isn’t one uses raw HTML, and in Scrivener one can put raw HTML around styled text at will:
- Right-click on the “Basic MultiMarkdown” Format and “Duplicate & Edit”.
- Click on the Styles pane, and then the + symbol, selecting the project style you wish to address from the list.
- Set Treat as raw markup so you can type in your own HTML, and then do so using the available prefix/suffix fields. For example:
That should cover the basics, the intermediates and even some advanced stuff as well. And since at most all we are doing in the editor is adding or adjusting styles a bit—we aren’t touching your project’s ability to continue using the WYSIWYG style outputs one bit. Everything that makes this work happens in the compile Format itself, and the settings that are bound to that format.
One last thing: if you prefer a “snippet” of HTML rather than a full document with a head and body, then go into the Metadata compile option pane and remove the “Title” and “Author” metadata keys from the lower section.