- name
- markdown-mobile-export
- description
- >-
- argument-hint
- [--input-file path | --markdown-text text]
- metadata
- version
- 0.1.0
Markdown Mobile Export
Faithful Markdown → mobile long image, no content rewriting.
When to Use
- Local
.md file → phone-friendly long image - Pasted Markdown text → PNG or JPG
- Article-style faithful export (not poster or carousel redesign)
- Intermediate HTML needed for inspection alongside image
Do Not Use
- Poster redesigns where content should be rewritten into marketing blocks
- Carousel slicing across multiple images
- Rich web app UI design work
- PDF output
Quick Start
# From file
python3 {baseDir}/scripts/markdown_to_long_image.py \
--input-file /path/to/file.md
# From pasted text
python3 {baseDir}/scripts/markdown_to_long_image.py \
--markdown-text "# Title\
\
Body"
# Custom output path and format
python3 {baseDir}/scripts/markdown_to_long_image.py \
--input-file /path/to/file.md \
--output-image /path/to/output.png \
--format jpg
Defaults
| Aspect | Default |
|---|
| Input | Markdown file path or pasted text |
| Output | PNG long image + HTML sidecar retained on disk |
| Style | Faithful conversion, mobile-first, zh-CN typography |
| Width | 820px card layout with warm earth-tone theme |
| Browser | Local Chrome/Chromium/Edge/Brave → Playwright fallback |
Workflow
- Resolve input (
--input-file or --markdown-text) - Normalize pasted text into a concrete
.source.md file when needed - Render mobile-friendly HTML with embedded CSS
- Detect local Chromium-family browser
- Capture full-page screenshot (segmented stitch with overlap)
- Fall back to Playwright Chromium if no local browser is usable
- Print JSON result with
output_html and output_image paths
Scripts
| Script | Purpose |
|---|
scripts/markdown_to_long_image.py | CLI entry point, orchestrates pipeline |
scripts/render_markdown_mobile_long_image.py | Markdown → styled mobile HTML |
scripts/export_long_image.py | Browser detection + screenshot export |
References
| Topic | File |
|---|
| Pipeline details | references/workflow.md |
| Common issues | references/troubleshooting.md |
Validation
After generating output, verify:
- HTML file exists at reported path
- Image file exists and is non-zero bytes
- Image is full-page capture (not single viewport crop)
- Remote images loaded without broken placeholders