Strip comments and header metadata on ODT export
Each file is now cleaned before conversion: HTML comments are removed and everything above the configurable Draft marker (default "### Rough Draft:") is dropped. A "# Title:" line becomes the chapter heading and a "# Slug:" line becomes an italic caption beneath it. - new preprocess module (strip_comments + header parse) with tests - Chapter gains a slug rendered via a Chapter_20_Caption style, italic at both paragraph-style and character-run level - draft_marker config setting + top-bar field - export title priority: override > # Title: > first # heading > filename Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -66,11 +66,43 @@ Terminal=false
|
||||
to write to disk. Drag the `⠿` handles to reorder.
|
||||
4. Set the **Chapter title** for the open file if you want to override the
|
||||
auto-derived one (the field shows the automatic title as a hint). Leaving it
|
||||
blank falls back to the file's first level-1 heading (`# ...`), or the file
|
||||
name. Titles are saved to `titles.json` and sync with git.
|
||||
blank falls back to a `# Title:` line, then the file's first level-1 heading
|
||||
(`# ...`), then the file name. Titles are saved to `titles.json` and sync with
|
||||
git.
|
||||
5. Set the **Export** path and press **Export ODT** to produce the concatenated
|
||||
document. Each file becomes a chapter headed by its (overridden or automatic)
|
||||
title; the source's leading `# heading` is consumed as that title slot.
|
||||
document. Each file becomes a chapter headed by its title, optionally followed
|
||||
by a caption from its `# Slug:` line.
|
||||
|
||||
## Header stripping on export
|
||||
|
||||
Manuscript files often carry editorial notes and metadata above the prose that
|
||||
should not appear in the finished document. On export, each file is cleaned up:
|
||||
|
||||
* **HTML comments** (`<!-- ... -->`, including multi-line ones) are removed.
|
||||
* **The header block** — everything above the **Draft marker** line (set in the
|
||||
top bar; default `### Rough Draft:`) — is dropped. From that header:
|
||||
* `# Title:` becomes the chapter heading (unless a manual override is set), and
|
||||
* `# Slug:` becomes an italic caption printed beneath the heading.
|
||||
|
||||
Any other header text is discarded. Files with no marker line are exported
|
||||
whole, but stray `# Title:` / `# Slug:` lines are still lifted out. Clear the
|
||||
Draft marker field to disable header splitting entirely.
|
||||
|
||||
For example, this source file:
|
||||
|
||||
```markdown
|
||||
# Title: The Gate
|
||||
# Slug: in which the door will not open
|
||||
<!-- remember to foreshadow the key -->
|
||||
outline: she arrives, she knocks, nothing
|
||||
|
||||
### Rough Draft:
|
||||
|
||||
The prose that actually gets exported begins here.
|
||||
```
|
||||
|
||||
exports as a chapter titled **The Gate**, captioned *in which the door will not
|
||||
open*, containing only the prose below the marker.
|
||||
|
||||
## Files the app writes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user