AI Agent Hub
Back to skills
Markdown to Professional PDF Conversion icon

Markdown to Professional PDF Conversion

Office Efficiency Updated 2026.08.30

Paste the following prompt into your AI chat to install this skill:

Please install @user_09b3713d/md2pdf according to https://skillhub.cn/install/skillhub.md.

About this skill

Problem

Converting Markdown to PDF is rarely blocked by whether a command exists; the hard part is stable typography. Technical documents often mix CJK text, Latin text, code blocks, tables, and nested lists. Naive converters may render CJK glyphs as boxes, collapse code indentation or line breaks, split English-CJK boundaries awkwardly, fail on cover, header, or footer text, produce unbalanced table widths, or merge headings so bookmarks and TOC become unreliable.

How it works

This skill treats Markdown as a structured source and uses Python reportlab to produce delivery-ready PDFs. It targets the failure modes of mixed-language documents and code-heavy content:
- Font switching: separate fonts for Latin body, CJK body, and code, with fallback on Linux;
- Mixed rendering: _font_wrap() handles paragraph text, while _draw_mixed() handles cover, header, and footer content with mixed CJK/Latin strings;
- Code fidelity: esc_code() preserves line breaks and indentation before font wrapping is applied;
- Document structure: optional cover page, table of contents, sidebar bookmarks, watermark, frontispiece image, back-cover banner, and copyright text;
- Themes: built-in styles such as warm-academic, classic-thesis, tufte, and ieee-journal, plus custom theme files for background, ink, accent, and code colors.

Boundaries and notes

It is best for reports, white papers, technical proposals, and tutorials whose content is mostly headings, paragraphs, lists, tables, and code blocks. Before conversion, confirm theme, cover, frontispiece, watermark, and back-cover details. If an AI-generated frontispiece is selected, generate and approve the image first, then pass the file path. For heavily custom HTML, complex floating layouts, very long code samples, or unusual symbols, validate a small sample before batch use.

Use Cases

  • Convert a technical proposal Markdown with code samples and tables into a review-ready PDF without breaking CJK-Latin lines
  • Generate a product white paper with cover, TOC, watermark, and chapter bookmarks for client navigation
  • Export meeting notes with mixed CJK and Latin text to an A4 document while preserving code block indentation
  • Prepare an open-source contribution guide with a GitHub-style theme and back-cover copyright for external release

Best For

  • Engineers writing Chinese technical docs who need stable Markdown-to-PDF conversion
  • Product managers preparing client white papers with cover, TOC, watermark, and formal themes
  • Technical writers maintaining mixed Chinese-English tutorials with reliable code indentation and CJK wrapping
  • Architects assembling review materials who need chapter bookmarks and navigable PDF output