Markdown Professional PDF Converter
Paste the following prompt into your AI chat to install this skill:
Please follow https://skillhub.cn/install/skillhub.md to install @user_1ae97d99/mdtopdf into your current AI assistant.
About this skill
The Problem
Markdown is often readable in a browser, but it is not always stable for printing, archiving, or formal delivery. Issues such as A4 margins, page numbers, Chinese typography, code highlighting, table pagination, and link rendering can affect the final appearance. mdtopdf targets this document-output use case by converting Markdown into a consistent PDF instead of relying on browser print behavior or ad hoc styling.
How It Works
It is built on md2pdf and WeasyPrint, using @scripts/convert.py to read a Markdown file and apply @assets/markdown.css. The default layout includes A4 pages, 25mm/20mm margins, footer page numbers, serif body text, and sans-serif headings. Code blocks use a monospace stack with Pygments GitHub-style highlighting; tables get borders, alternating row colors, and repeating headers across pages; blockquotes, links, and page breaks are also print-aware. If the Markdown does not start with a heading, --title can inject one. Relative image paths depend on base_url, which the conversion script sets to the Markdown file's parent directory.
It also supports customizing the output: you can pass your own CSS or call the Python API directly to adjust styles, titles, fonts, and pagination behavior. By default, it enables extensions such as GFM tables, pymdownx.superfences, footnotes, and smart punctuation, making it suitable for technical documents with tables, code blocks, footnotes, and Chinese text.
Limits and Notes
This skill is best for producing formal PDFs from Markdown, not for JavaScript-rendered pages, interactive components, or complex web layouts. Missing Chinese fonts can produce square glyphs, so the environment should provide CJK fonts. Missing system libraries required by WeasyPrint can prevent it from running, and the documented str | None case requires Python 3.10+. When customizing styles, extend or override the default CSS and confirm that image paths resolve, to avoid blank pages or missing images.
Use Cases
- Convert technical spec Markdown with tables, code blocks, and footnotes into A4 PDFs for internal review.
- Generate formal delivery notes from shared Markdown with page numbers, Chinese fonts, and code highlighting.
- Turn installation guides with relative screenshots into stable PDFs with correct image paths and heading styles.
- Customize headers, footers, and fonts, then output project docs as printable A4 or Letter PDFs.
Best For
- Technical engineers writing docs: need Markdown with code blocks, tables, and footnotes exported to archivable PDFs.
- Documentation owners handling product delivery: need consistent-layout customer docs with correct Chinese fonts.
- Engineers maintaining internal knowledge bases: need guides with screenshots and relative links turned into stable print PDFs.
- Technical writers publishing release notes: want custom CSS control over headers, footers, and fonts.
Related Skills
Runs rule and semantic checks on Word files, adds comments, and applies GB/T 9704-2012 party/government formatting.
Generate professional .pptx presentations from a topic or outline, with themes, common layouts, speaker notes, and 16:9/4:3 support.
Generates a fixed-structure A-share tech daily across five tracks, screening 24-hour news and selecting leader and growth stocks.
Convert teaching schedules from talent development plan PDFs into structured Excel files, with cross-page tables, merged cells, multi-semester course splitting, major metadata extraction, and batch output.