Vellum Prep
Convert markdown manuscripts to Vellum-ready Word documents.
When to Use
Use this skill when you have a markdown manuscript (from OCR, writing, or conversion) that needs to be formatted for import into Vellum book formatting software.
What It Does
Programmatic cleanup (no AI tokens):
- Removes OCR metadata headers (processing timestamps, chunk markers, model info)
- Converts
--- to *** (Vellum ornamental breaks)
- Removes duplicate running headers (e.g., repeated book title)
- Removes
[Image: ...] placeholder descriptions (margin notes, decorations, back covers)
- Strips publisher front matter (catalogs, copyright boilerplate, pricing, paper notices)
- Strips publisher back matter (advertising sections, "By the Same Author", press notices for other books)
- Removes Contents/TOC tables (Vellum auto-generates)
- Normalizes chapter headings to
# Chapter X: Title format
- Fixes OCR hyphenation artifacts (
defi- nition → definition) via regex (\w)- (\w)
- Fixes bold all-caps drop caps (
**GOD** is → God is, IT is → It is)
- Detects and removes duplicate content from OCR chunk boundary overlaps
- Cleans common artifacts (page numbers, ellipses)
- Converts to .docx via pandoc
Editorial judgment (requires reading):
- Evaluate front matter: what's essential for a modern reprint vs. dated (WWI paper shortages, original pricing, publication venue mentions)
- Evaluate back matter: keep charming period testimonials, cut advertising for other books
- Flag corrupted chunk boundaries where text is truncated or garbled (mark with
[text missing])
- Add review request page (tasteful, genre-appropriate, after last chapter)
- Add copyright/public domain notice page
Usage
# From the manuscript directory:
python3 /path/to/vellum_prep.py manuscript.md
# Output: manuscript_vellum.md + manuscript.docx (if pandoc available)
Or invoke via Claude:
/vellum-prep manuscript.md
Vellum Formatting Rules
| Markdown |
Word Style |
Vellum Element |
# Chapter 1: Title |
Heading 1 |
Chapter |
# Dedication |
Heading 1 |
Dedication |
# Prologue |
Heading 1 |
Prologue |
## Section |
Heading 2 |
Level 1 Subhead |
*** |
Centered asterisks |
Ornamental Break |
| Single blank line |
Blank paragraph |
Scene Break |
Configuration
Edit the script to customize:
header_patterns: List of regex patterns for headers to remove
remove_images: Whether to strip [Image: ...] tags
clean_for_vellum: Apply Vellum-specific formatting
Requirements
- Python 3.x
- pandoc (for .docx conversion)
Handling Complex Manuscripts
For manuscripts with special requirements (Notion exports, external images, nested chapters), create a book-specific preprocessing script. See Personal/Guide Abrege/prep_guide_abrege.py for an example that handles:
Notion Export Issues
Nested Chapter Headings
When a document has nested "CHAPTER I/II/III" within sections (e.g., each movement family has its own Chapter I, II, III):
- Keep top-level sections as
# (Vellum chapters)
- Demote internal "CHAPTER X:" labels to
## subheadings
- Strip the "CHAPTER X:" prefix, keep just the descriptive title
Tables
- Multi-line cells in markdown tables don't convert well via pandoc - convert to numbered lists instead
- See
prep_guide_abrege.py for regex pattern to match and replace specific tables
Bold Labels as Headings
Instructional books often use **FIRST TYPE:** or **Method A:** as implicit subheadings. Convert these to actual headings (####) for proper Vellum hierarchy.
Workflow for Complex Books
- Run exploratory agent to analyze structure
- Create book-specific prep script
- Download/remap external images
- Run prep script → intermediate
.md
- Run
pandoc directly (not vellum_prep.py) to preserve images
- Review in Vellum, fix Parts/special elements manually
Public Domain Reprint Checklist
For reprints of out-of-copyright works:
- Copyright page: "Original work by [Author] is in the public domain. This edition, including arrangement and typesetting, copyright [YEAR] [Publisher]. Cover design copyright [YEAR] [Publisher]."
- Review request page: After final chapter, before appendices. Thank the reader, explain why reviews matter, clear CTA. Match the book's register (devotional ≠ business).
- Front matter triage: Keep prefaces that frame the work theologically/historically. Cut paragraphs about paper shortages, original pricing, publication venues (e.g., "first appeared in the American Catholic Quarterly Review").
- Back matter triage: Keep period testimonial letters (charming, historical). Cut "By the Same Author" advertising sections, press notices for other books, publisher catalogs.
- Contents table: Always remove — Vellum generates its own.
OCR Chunk Boundary Traps
When manuscripts come from chunked OCR (e.g., Gemini vision processing PDFs in 15-page chunks):
- Truncated sentences: Text cuts off mid-word at chunk end, next chunk starts mid-paragraph. Look for abrupt
...afteIs it not type joins.
- Duplicate content: Same passage appears at end of one chunk and start of the next. The Newman development section appeared in both Ch II and Ch III — had to identify which chapter it properly belonged to and remove the duplicate.
- Garbled text: Chunk boundary corruption produces nonsense like
vouchsafed to themple in point (should be "vouchsafed to them... example in point"). Flag with [text missing] if unrecoverable.
- Orphaned sentences: Random sentences that don't fit context, dragged from adjacent chunks. Remove after verifying they appear correctly elsewhere.
Files
SKILL.md - This file
vellum_prep.py - Main conversion script (OCR cleanup focus)
1---2name: vellum-prep3description: Vellum Prep4---5# Vellum Prep67Convert markdown manuscripts to Vellum-ready Word documents.89## When to Use1011Use this skill when you have a markdown manuscript (from OCR, writing, or conversion) that needs to be formatted for import into Vellum book formatting software.1213## What It Does1415**Programmatic cleanup (no AI tokens):**16- Removes OCR metadata headers (processing timestamps, chunk markers, model info)17- Converts `---` to `***` (Vellum ornamental breaks)18- Removes duplicate running headers (e.g., repeated book title)19- Removes `[Image: ...]` placeholder descriptions (margin notes, decorations, back covers)20- Strips publisher front matter (catalogs, copyright boilerplate, pricing, paper notices)21- Strips publisher back matter (advertising sections, "By the Same Author", press notices for other books)22- Removes Contents/TOC tables (Vellum auto-generates)23- Normalizes chapter headings to `# Chapter X: Title` format24- Fixes OCR hyphenation artifacts (`defi- nition` → `definition`) via regex `(\w)- (\w)`25- Fixes bold all-caps drop caps (`**GOD** is` → `God is`, `IT is` → `It is`)26- Detects and removes duplicate content from OCR chunk boundary overlaps27- Cleans common artifacts (page numbers, ellipses)28- Converts to .docx via pandoc2930**Editorial judgment (requires reading):**31- Evaluate front matter: what's essential for a modern reprint vs. dated (WWI paper shortages, original pricing, publication venue mentions)32- Evaluate back matter: keep charming period testimonials, cut advertising for other books33- Flag corrupted chunk boundaries where text is truncated or garbled (mark with `[text missing]`)34- Add review request page (tasteful, genre-appropriate, after last chapter)35- Add copyright/public domain notice page3637## Usage3839```bash40# From the manuscript directory:41python3 /path/to/vellum_prep.py manuscript.md4243# Output: manuscript_vellum.md + manuscript.docx (if pandoc available)44```4546Or invoke via Claude:47```48/vellum-prep manuscript.md49```5051## Vellum Formatting Rules5253| Markdown | Word Style | Vellum Element |54|----------|-----------|----------------|55| `# Chapter 1: Title` | Heading 1 | Chapter |56| `# Dedication` | Heading 1 | Dedication |57| `# Prologue` | Heading 1 | Prologue |58| `## Section` | Heading 2 | Level 1 Subhead |59| `***` | Centered asterisks | Ornamental Break |60| Single blank line | Blank paragraph | Scene Break |6162## Configuration6364Edit the script to customize:65- `header_patterns`: List of regex patterns for headers to remove66- `remove_images`: Whether to strip `[Image: ...]` tags67- `clean_for_vellum`: Apply Vellum-specific formatting6869## Requirements7071- Python 3.x72- pandoc (for .docx conversion)7374## Handling Complex Manuscripts7576For manuscripts with special requirements (Notion exports, external images, nested chapters), create a **book-specific preprocessing script**. See `Personal/Guide Abrege/prep_guide_abrege.py` for an example that handles:7778### Notion Export Issues79- **Missing image folders**: Notion exports reference `FolderName/image.png` but don't always include the folder80- **Substack CDN images**: Can be downloaded with curl and remapped to local paths81- **Image mapping pattern**:82 ```python83 IMAGE_MAP = {84 "substack-uuid_dimensions.png": "images/01-descriptive-name.png",85 }86 ```8788### Nested Chapter Headings89When a document has nested "CHAPTER I/II/III" within sections (e.g., each movement family has its own Chapter I, II, III):90- Keep top-level sections as `#` (Vellum chapters)91- Demote internal "CHAPTER X:" labels to `##` subheadings92- Strip the "CHAPTER X:" prefix, keep just the descriptive title9394### Tables95- Multi-line cells in markdown tables **don't convert well** via pandoc - convert to numbered lists instead96- See `prep_guide_abrege.py` for regex pattern to match and replace specific tables9798### Bold Labels as Headings99Instructional books often use `**FIRST TYPE:**` or `**Method A:**` as implicit subheadings. Convert these to actual headings (`####`) for proper Vellum hierarchy.100101### Workflow for Complex Books1021. Run exploratory agent to analyze structure1032. Create book-specific prep script1043. Download/remap external images1054. Run prep script → intermediate `.md`1065. Run `pandoc` directly (not vellum_prep.py) to preserve images1076. Review in Vellum, fix Parts/special elements manually108109## Public Domain Reprint Checklist110111For reprints of out-of-copyright works:1121131. **Copyright page**: "Original work by [Author] is in the public domain. This edition, including arrangement and typesetting, copyright [YEAR] [Publisher]. Cover design copyright [YEAR] [Publisher]."1142. **Review request page**: After final chapter, before appendices. Thank the reader, explain why reviews matter, clear CTA. Match the book's register (devotional ≠ business).1153. **Front matter triage**: Keep prefaces that frame the work theologically/historically. Cut paragraphs about paper shortages, original pricing, publication venues (e.g., "first appeared in the American Catholic Quarterly Review").1164. **Back matter triage**: Keep period testimonial letters (charming, historical). Cut "By the Same Author" advertising sections, press notices for other books, publisher catalogs.1175. **Contents table**: Always remove — Vellum generates its own.118119## OCR Chunk Boundary Traps120121When manuscripts come from chunked OCR (e.g., Gemini vision processing PDFs in 15-page chunks):122123- **Truncated sentences**: Text cuts off mid-word at chunk end, next chunk starts mid-paragraph. Look for abrupt `...afteIs it not` type joins.124- **Duplicate content**: Same passage appears at end of one chunk and start of the next. The Newman development section appeared in both Ch II and Ch III — had to identify which chapter it properly belonged to and remove the duplicate.125- **Garbled text**: Chunk boundary corruption produces nonsense like `vouchsafed to themple in point` (should be "vouchsafed to them... example in point"). Flag with `[text missing]` if unrecoverable.126- **Orphaned sentences**: Random sentences that don't fit context, dragged from adjacent chunks. Remove after verifying they appear correctly elsewhere.127128## Files129130- `SKILL.md` - This file131- `vellum_prep.py` - Main conversion script (OCR cleanup focus)