xiaohongshu
xiaohongshu
pdf-conversion
Converts Markdown files to professional PDF documents using WeasyPrint. Use when user wants to convert markdown to PDF, export as PDF, or generate PDF from documents. Supports custom CSS styling, page headers/footers, and Autodesk brand themes.
Full skill instructions
Convert Markdown files to professional PDF documents using WeasyPrint (HTML→PDF engine) with customizable CSS styling. Runs entirely in sandbox with no external dependencies beyond Python packages.
| Component | Library | Purpose |
|---|---|---|
| MD Parser | markdown | Convert Markdown → HTML with extensions |
| PDF Engine | weasyprint | Render HTML+CSS → PDF |
| Styling | Custom CSS | Professional typography and layout |
| Feature | Status | Notes |
|---|---|---|
| Headers (h1-h6) | ✅ | Proper hierarchy styling |
| Bold/Italic | ✅ | Standard inline formatting |
| Lists (ordered/unordered) | ✅ | Nested list support |
| Code blocks | ✅ | Syntax-highlighted with fenced_code |
| Tables | ✅ | GFM-style tables |
| Links | ✅ | Clickable in PDF |
| Images | ✅ | Embedded (local paths) |
| Blockquotes | ✅ | Styled callouts |
| Horizontal rules | ✅ | Section dividers |
| Task lists | ✅ | Checkbox rendering |
| Footnotes | ✅ | End-of-document notes |
| Table of Contents | ✅ | Auto-generated with [TOC] |
# One-time setup (if not done)
cd /Users/samarvir/code/autodesk/Product\ management
source .venv/bin/activate
pip install markdown weasyprint
# Basic conversion
python .claude/skills/md-to-pdf/convert_md_to_pdf.py input.md output.pdf
# With options
python .claude/skills/md-to-pdf/convert_md_to_pdf.py input.md output.pdf \
--css custom.css \
--page-size letter \
--title "Document Title"
**PDF Generated Successfully**
**Input**: input.md
**Output**: Output/document.pdf
**Pages**: [N] pages
**Size**: [X] KB
Styling: [default/custom CSS path]
| Argument | Type | Default | Description |
|---|---|---|---|
input | positional | required | Input Markdown file path |
output | positional | required | Output PDF file path |
--css | string | default.css | Custom CSS file path |
--page-size | string | a4 | Page size: a4, letter, legal |
--margin | string | 2.5cm | Page margins |
--title | string | (from md) | Document title for header |
--no-toc | flag | false | Disable table of contents |
--no-header | flag | false | Disable page header |
--no-footer | flag | false | Disable page footer |
python .claude/skills/md-to-pdf/convert_md_to_pdf.py \
Initiatives/docs-integration/prd.md \
Output/prd.pdf
python .claude/skills/md-to-pdf/convert_md_to_pdf.py \
Initiatives/ai-renderings/case-for-a-new-squad.md \
Operations/adhoc/ai-renderings/proposal.pdf \
--css .claude/skills/md-to-pdf/styles/autodesk.css \
--title "AI Renderings Squad Proposal"
python .claude/skills/md-to-pdf/convert_md_to_pdf.py \
document.md \
document.pdf \
--page-size letter \
--margin 1in
| Theme | File | Use Case |
|---|---|---|
| Default | default.css | Clean, professional documents |
| Autodesk | autodesk.css | Autodesk brand colors |
| Minimal | minimal.css | Simple, no-frills output |
Create your own CSS file with:
@page rules for margins, headers, footersExample custom CSS sections:
/* Page setup */
@page {
size: A4;
margin: 2.5cm;
@top-center { content: "Document Title"; }
@bottom-right { content: "Page " counter(page); }
}
/* Typography */
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
font-size: 11pt;
line-height: 1.6;
}
/* Headers */
h1 { color: #1D91D0; page-break-before: always; }
h1:first-of-type { page-break-before: avoid; }
Follow the project's Output Location Protocol:
| Document Type | Save To | Example |
|---|---|---|
| Initiative PRDs | Initiatives/[name]/ | Initiatives/ai-renderings/prd.pdf |
| Leadership Docs | Operations/recurring/ | leadership-reviews/q1-2026.pdf |
| Ad-hoc Analysis | Operations/adhoc/[topic]/ | adhoc/market-analysis/report.pdf |
| Test/Temporary | Output/ | Output/test.pdf |
| Rule | Implementation |
|---|---|
| No user input in file paths | Validated input/output paths |
No eval/exec | Pure library API calls |
| No subprocess | WeasyPrint is pure Python |
| Input validation | File existence checks |
| Sandboxed execution | Runs in Cursor sandbox |
| Resource limits | Handles large files gracefully |
| Issue | Cause | Fix |
|---|---|---|
| Missing fonts | System fonts not available | Use web-safe fonts in CSS |
| Images not showing | Relative paths broken | Use absolute paths or --base-path |
| Tables overflow | Wide tables | Add table { width: 100%; } to CSS |
| No page breaks | CSS missing rules | Add h1 { page-break-before: always; } |
| WeasyPrint warnings | Font/CSS issues | Usually safe to ignore |
python .claude/skills/md-to-pdf/convert_md_to_pdf.py input.md output.pdf --debug
Outputs:
| File | Purpose |
|---|---|
.claude/skills/md-to-pdf/SKILL.md | This documentation |
.claude/skills/md-to-pdf/convert_md_to_pdf.py | Main converter script |
.claude/skills/md-to-pdf/default.css | Default styling |
.claude/skills/md-to-pdf/styles/ | Additional CSS themes |
cd /Users/samarvir/code/autodesk/Product\ management
source .venv/bin/activate
pip install markdown weasyprint
| Package | Version | Purpose |
|---|---|---|
markdown | >=3.4 | Markdown parsing with extensions |
weasyprint | >=60.0 | HTML to PDF rendering |
WeasyPrint requires some system libraries. On macOS:
brew install pango
If you encounter font issues:
brew install fontconfig
For integration with other scripts:
from convert_md_to_pdf import MarkdownToPDF
converter = MarkdownToPDF(
css_path="default.css",
page_size="a4",
margin="2.5cm"
)
# Convert file
converter.convert_file("input.md", "output.pdf")
# Convert string
converter.convert_string(
markdown_text="# Hello World\n\nThis is a test.",
output_path="output.pdf",
title="Test Document"
)
--debug first for complex documents[TOC] for documents > 5 pages--allow-remote flagI'll convert the Markdown file to PDF.
**Input**: [filename.md]
**Output**: [path/output.pdf]
**Styling**: [default/custom]
**Page Size**: [A4/Letter]
Converting...
**PDF Generated Successfully**
**File**: `Output/[filename].pdf`
**Pages**: [N] pages
**Size**: [X] KB
The PDF includes:
- [TOC if present]
- [N] sections
- [N] tables
- [N] images
Open the PDF to review formatting.
**PDF Generation Failed**
**Error**: [error message]
Troubleshooting:
1. [specific fix based on error]
2. Run with `--debug` for more info
3. Check CSS syntax if using custom styles
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience