export/compile to structured files

Are there ways to get Scrivener to export or compile to a set of marked up files, html or mml or otherwise, such that each section goes in its own page, hyperlinks connect table of contents to each page, and each page contains next/previous links?

Not getting any responses to this or an earlier post, so I’ll just talk to myself – in case anyone else has similar questions.

I thought maybe the silence was due to my missing something obvious in the documentation, but that doesn’t seem to be it. Alternatively, I could have been asking for something that Scrivener isn’t meant to do. That’s probably closer. But this is a real use case: wanting the support Scrivener can provide to writing a book and exporting it normally as one big file, but also wanting the option of having it easily port to HTML with separate, linked files for each section.

So far, the likeliest solution I can find is export to OPML. This gives one big file like the other export/compile options, but since the output is a simple XML format, it should be easy to write a script in PHP or any other language to split it up into appropriate files. I haven’t tried it yet, so I don’t know how well OPML preserves or handles text formatting, intra-document links, etc.

Can anyone point me to discussion or documentation about scripting custom handling of Scrivener exports?

HTML export goes to separate files, but there are no links between them, and so far my attempts to make an HTML table of contents are not useful. Maybe messing with those is my solution.


No, there’s no way to do this at the moment. It’s on the list as a future possibility - to generate multiple HTML files during Compile that link to one another - but there’s nothing definite, as it is a little outside what Scrivener was meant to do. That said, it’s epub export does something similar to this, so one thing you could do is export to the epub format and then extract the HTML files from that (an .epub file is just a .zip file - so rename the .epub extension to “.zip” and extract the files. In there you will find a folder of HTML files). The files aren’t structured, but you can generate a ToC automatically.

All the best,