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:
landon
2026-07-25 19:01:45 -05:00
parent f473b63ee3
commit 507e0ab724
6 changed files with 279 additions and 9 deletions
+11
View File
@@ -11,6 +11,16 @@ pub struct Config {
/// Whether to show the live preview pane.
#[serde(default)]
pub show_preview: bool,
/// Marker line separating a file's editorial header from its prose. Content
/// above it (except `# Title:` / `# Slug:` metadata) is dropped on export.
/// An empty value disables header splitting.
#[serde(default = "default_marker")]
pub draft_marker: String,
}
/// Default header/body separator, matching the manuscript drafting convention.
pub fn default_marker() -> String {
"### Rough Draft:".to_string()
}
impl Default for Config {
@@ -21,6 +31,7 @@ impl Default for Config {
workspace,
export_path,
show_preview: false,
draft_marker: default_marker(),
}
}
}