A browser-based document editor with live preview and PDF generation.
- Markdown mode: Edit
.mdfiles with live preview - HTML mode: Edit
.htmlfiles with iframe preview - Template mode: Edit markdown and render through styled HTML templates for PDF generation
- PDF generation: Uses headless Chrome to generate PDFs from HTML or templated markdown
- PDF page estimate: Shows a live estimated PDF page count for Markdown files
- Keyboard shortcuts:
Cmd+Sto save,Cmd+Pto generate PDF
Start the server:
python3 server.pyThen open in browser:
# Markdown editing
http://localhost:8888/doc-editor.html?file=/path/to/file.md
# HTML editing
http://localhost:8888/doc-editor.html?file=/path/to/file.html
# Template mode (markdown → styled PDF)
http://localhost:8888/doc-editor.html?file=/path/to/file.md&template=answerlayer-branded.html
Templates live in the templates/ directory. They're HTML files with placeholders:
{{title}}- Document title from frontmatter{{content}}- Rendered markdown content<!-- Populated from frontmatter -->- Meta info (prepared for,status,date,version)
Current templates include:
answerlayer-sow-readable.html- Same branded styling with serif headings and sans-serif body textanswerlayer-legal.html- Legal/document-heavy templatemidas-branded.html- Midas Labs-inspired template based on the currentmidaslabs.cavisual system
Markdown files can include YAML frontmatter:
---
title: Project Proposal
prepared for: Acme Corp
status: Draft
date: 2026-03-18
version: 1.0
---
# Document content here...client still works as a backward-compatible alias for prepared for.
| Endpoint | Method | Description |
|---|---|---|
/load?file=PATH |
GET | Load file content |
/save?file=PATH |
POST | Save file content |
/preview-html?file=PATH |
GET | Serve HTML file for preview |
/render-markdown?template=NAME |
POST | Render markdown through template |
/estimate-pdf-pages?template=NAME |
POST | Estimate PDF page count for markdown |
/templates |
GET | List available templates |
/generate-pdf?html=PATH&pdf=PATH |
POST | Generate PDF from HTML |
/generate-pdf-from-markdown?file=PATH&pdf=PATH&template=NAME |
POST | Generate PDF from markdown |
- Python 3
- Google Chrome (for PDF generation)
Edit server.py to change:
CHROME_PATH- Path to Chrome executableTEMPLATES_DIR- Path to templates directory- Port (default: 8888)