Exporting to HTML
Twain can export the document you are viewing as a single, self-contained HTML file.
Export is part of Twain Pro.
Exporting
With a document open in a rendered view, choose File ▸ Export ▸ As HTML… and pick where to save it. The export is disabled in the raw source view, since it exports the rendered result.
What "self-contained" means
The exported file is designed to travel on its own:
- The styling is embedded, so the file looks right without any accompanying stylesheet.
- Local images are embedded directly into the file, so a document that references pictures next to it still shows them after you move or email the HTML.
- Mermaid diagrams are embedded as inline SVG, so they appear in the exported file without needing the Mermaid library.
- The current light or dark appearance and reading font are baked into the export.
A few things to keep in mind:
- Remote images (loaded over
https) stay as links to their original location, so viewing them later needs a connection. - A local image that is missing or unreadable is left as-is in the export rather than dropped, so a broken image in the document stays broken in the file.
- Maths is not fully self-contained. KaTeX's own web fonts are not embedded, so equations in an exported file fall back to whatever serif font the reader's machine provides. Simple expressions stay readable, but spacing will differ from the app and specialist symbols (blackboard bold, script, fraktur, large delimiters) may not render correctly. The same is true of CLI exports.
- The reading theme (Sepia, High Contrast), the reading width and the current text size are not carried over. The exported file uses the default width and text size, and follows plain light or dark rather than the reading theme you were using.
To produce a paper or PDF version instead, see Printing and PDF.
Exporting from the command line
If you want to script exports, the CLI has render and export commands that
write a self-contained HTML page, with the stylesheet inlined and local images embedded. Only
export takes --profile, for choosing a theme, font, and width; render always uses the
defaults. The CLI has no browser, so Mermaid fences stay as code blocks there rather than becoming
diagrams the way they do in the app's export.