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
+9 -13
View File
@@ -813,10 +813,6 @@ order: {}
---
## Draft Content
### Rough Draft:
[Write your scene content here...]
---
@@ -2027,14 +2023,14 @@ mod tests {
#[test]
fn render_template_expands_every_placeholder() {
let out = render_template(
"# Title: {{name}}\n# Started: {{date}}\n\n{{marker}}\n",
"---\ntitle: {{name}}\n---\n",
"untitled-7",
"### Rough Draft:",
"",
"2026-08-22",
);
assert_eq!(
out,
"# Title: untitled-7\n# Started: 2026-08-22\n\n### Rough Draft:\n"
"---\ntitle: untitled-7\n---\n"
);
}
@@ -2074,7 +2070,7 @@ mod tests {
assert_eq!(h.slug, None);
assert_eq!(h.pov, None);
assert_eq!(h.goal, None);
// Nothing above the marker leaks into the exported prose.
// Nothing above the --- leaks into the exported prose.
assert_eq!(h.body.trim(), "");
}
@@ -2083,8 +2079,7 @@ mod tests {
fn filled_template_parses_into_header_fields() {
let marker = crate::config::default_marker();
let seeded = render_template(
"# Title: {{name}}\n# Slug: the door\n# POV: Ada\n\
# Word Count Target: 1500 - 2000\n\n{{marker}}\n\nReal prose here.\n",
"---\ntitle: {{name}}\nslug: the door\npov: Ada\nword_count_target: 1500 - 2000\n---\n\nReal prose here.\n",
"chapter-02",
&marker,
"2026-08-22",
@@ -2102,11 +2097,12 @@ mod tests {
let out = render_template(
&crate::config::default_new_file_template(),
"chapter-01",
"### Rough Draft:",
"",
"2026-08-22",
);
assert!(out.starts_with("# Title: chapter-01\n"), "got {out:?}");
assert!(out.contains("\n### Rough Draft:\n"), "got {out:?}");
assert!(out.starts_with("---\n"), "got {out:?}");
assert!(out.contains("title: chapter-01"), "got {out:?}");
assert!(out.contains("---\n"), "got {out:?}");
assert!(!out.contains("{{"), "placeholder left unexpanded in {out:?}");
}