Yes, you can do both of these things with Scrivener, though there are some platform differences to be aware of.
-
On the Mac: go into the Sharing: Import preferences pane, and in the “Plain Text” section, note the file extension list on the right. Add ‘.html’, ‘.htm’ or whatever else you need here.
This will override the normal behaviour, where dropping HTML files into the binder will either archive them (using MHT or WebArchive) or convert them to editable formatted text. Neither is what you want.
-
On Windows: this option hasn’t been added yet, so normal import is off the table. You’ll need to copy and paste from a plain-text editor to bring raw HTML into the editor. That of course works on the Mac as well—maybe you don’t want to change that setting so you can continue archiving pages normally, well that’s how you’d get both.
So that gets the syntax into the editor, but in order for that to remain HTML through compile, you need to tell Scrivener that’s what you want. For all it knows you are writing about HTML and want it to print verbatim. To achieve that we need to use styles. First, let’s explore how that works.
- Open
File ▸ Compile..., set the Compile for option at the top to ePub, and select the “Ebook” compile Format in the left sidebar. - Double-click on it to duplicate and edit, and click on the Styles pane. Scrolling through that list you’ll find two prepared styles: “Raw HTML” and “Raw HTML Block”. One is for inline snippets of raw syntax, the other for whole chunks, as you would expect. Click on these, and note they are both set to use the Treat as raw markup flag. That’s the special sauce, you can apply that to any style you want.
We know what we need to know for now, make a mental note of these style names, and feel free to cancel out of this dialogue and Opt/Alt click on the “Compile” button to just save your changes to the file type and format.
Back in the editor, select the syntax you’ve imported (one way or another), and use the Format ▸ Styles ▸ New Style from Selection... menu command. The formatting and settings are completely arbitrary, do what works best for you, it will all be ignored completely, for obvious reasons. The only thing that matters is using one of the style names, depending on whether it is paragraph or character level.
Now as to your second question, yes you can insert text from .html files on the fly, using the placeholder documented in §10.1.5, Including Text From Other Documents, in the user manual PDF. If you intend to compile from multiple platforms, it’ll work best to keep the .html files in the same folder as the project, so you that you avoid having to give a full path, which will of course be completely different between Win/Mac.
However, I wouldn’t depend on that approach right now, as both platforms have bugs that relate to this feature that effectively make it not useful for inserting raw syntax.