feat: Remove ### Rough Draft: marker, use YAML frontmatter only for draft files

- Everything after YAML frontmatter closing --- is now considered the draft content
- No ### Rough Draft: marker needed
- Chapter titles are handled by the program on export based on file order
- Draft content should not include chapter titles
- Updated default_new_file_template to use YAML frontmatter
- Updated preprocess.rs to parse YAML frontmatter for metadata
- Updated all relevant tests
- Updated documentation in help.rs
- Updated template files

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
landon
2026-09-16 13:33:23 -05:00
parent aafe1786b5
commit a0d1c3c206
11 changed files with 243 additions and 550 deletions
+11 -15
View File
@@ -236,20 +236,16 @@ pub fn default_projects_dir() -> PathBuf {
})
}
/// Default new-file template: the editorial header fields this app already
/// understands, followed by the draft marker so the body starts below it.
///
/// Note: For YAML frontmatter support, create files manually with --- delimiters.
/// The legacy header format is kept for backward compatibility with the parser.
/// Default new-file template: Uses YAML frontmatter for metadata,
/// with everything after the closing --- being the draft content.
pub fn default_new_file_template() -> String {
[
"# Title: {{name}}",
"# Slug:",
"# POV:",
"# Word Count Target:",
"",
"{{marker}}",
"",
"---",
"title: {{name}}",
"slug: ",
"pov: ",
"word_count_target: ",
"---",
"",
]
.join("\n")
@@ -296,8 +292,9 @@ pub fn default_languagetool_language() -> String {
}
/// Default header/body separator, matching the manuscript drafting convention.
/// Now empty by default since we use YAML frontmatter.
pub fn default_marker() -> String {
"### Rough Draft:".to_string()
"".to_string()
}
impl Default for Config {
@@ -456,7 +453,7 @@ mod tests {
assert!(cfg.show_preview);
// The new field is filled in from its default rather than left blank.
assert_eq!(cfg.new_file_template, default_new_file_template());
assert!(cfg.new_file_template.contains("{{marker}}"));
assert!(cfg.new_file_template.contains("---"));
// Likewise the Gitea pair. `use_ssh` defaulting to *true* is the point:
// a `#[serde(default)]` bool would come back false and quietly attach
// every repository over HTTPS.
@@ -472,7 +469,6 @@ mod tests {
"workspace": "/home/writer/Manuscript",
"export_path": "/home/writer/Manuscript/book.odt",
"show_preview": true,
"draft_marker": "### Rough Draft:",
"editor_zoom": 10.0,
"languagetool_host": "lt.example.com",
"mistral_api_key": "secret",