agentleFS
Biraj2004Biraj2004/huashu-skills-english/huashu-md-to-pdf-en/SKILL.md

huashu-md-to-pdf

Skill3 starsChanged 6 months agoMITView on GitHub

Convert Markdown documents into professional Apple-style PDF white papers. Supports full Markdown syntax (code blocks, tables, blockquotes, lists, etc.). Auto-generates cover page, table of contents, and headers/footers. Use cases: technical documentation, white papers, tutorials, reports — any Markdown document requiring professional typesetting.

  • Installs packages

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If you encounter WeasyPrint installation issues (macOS):

    line 364

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Markdown to PDF Skill

Convert Markdown documents into professional Apple-design-style PDF white papers.

Core Features

  1. Professional typesetting: Book-quality layout with automatic handling of page breaks and widow/orphan control
  2. Apple design language: SF font system, modern minimalist style, professional colour palette
  3. Full table of contents: Automatically extracts chapter structure, dual-column layout, clickable page jumps
  4. Complete Markdown support: Code blocks, tables, blockquotes, lists — all rendered correctly

How to Use

Basic Usage

# Convert a single file
python scripts/convert.py input.md

# Specify output filename
python scripts/convert.py input.md -o "My White Paper.pdf"

# Custom title and author
python scripts/convert.py input.md --title "Technical White Paper" --author "Huashu"

Markdown Document Requirements

Your Markdown document should follow this structure:

# Document Title

## 1. Chapter One
### 1.1 Section One
### 1.2 Section Two

## 2. Chapter Two
### 2.1 Section One

Key rules:

  • Main chapters: ## 1. Title (number + full stop + space + title)
  • Sub-sections: ### 1.1 Title (number.number + space + title)
  • This structure is required for the table of contents to generate correctly

Design Features

Cover Design

  • Light grey gradient background
  • Large title: 64pt, clean and modern
  • Subtitle and metadata information

Table of Contents Design

  • Dual-column layout, fits on one page
  • Main chapters in bold, sub-sections indented
  • Clickable links that jump to the corresponding section

Body Typesetting

  • SF font family (Apple design language)
  • Line height 1.7 for comfortable reading
  • Chapters automatically start on a new page
  • Widow and orphan control

Code Blocks

  • Light grey background + fine border
  • 8px border radius
  • SF Mono monospace font
  • Automatic page break prevention

Tables

  • Clear grid lines
  • Light grey header row
  • Automatic header repeat (for tables that span multiple pages)

Configuration Options

To customise the style, edit the CSS variables in scripts/convert.py:

# Primary colour
PRIMARY_COLOR = '#06c'      # Apple blue
TEXT_COLOR = '#1d1d1f'      # Main text black
GRAY_COLOR = '#86868b'      # Light grey

# Font sizes
COVER_TITLE_SIZE = '64pt'
H2_SIZE = '22pt'
H3_SIZE = '17pt'
BODY_SIZE = '11pt'

Frequently Asked Questions

Q: Why is the table of contents empty?

A: Ensure your Markdown uses the correct chapter format:

  • ## 1. Title instead of ## Title
  • ### 1.1 Title instead of ### Title

Q: Code blocks not displaying correctly?

A: Ensure you're wrapping with three backticks:

```python
def hello():
    print("Hello")
```text

Q: Table formatting is broken?

A: Use standard Markdown table syntax:

| Column 1 | Column 2 |

    param($m)
    $inner = $m.Groups[1].Value
    # Split by | and fix each cell separator
    $cells = $inner -split '\|'
    $fixedCells = $cells | ForEach-Object {
      $cell = ---
name: huashu-md-to-pdf
description: |
  Convert Markdown documents into professional Apple-style PDF white papers.
  Supports full Markdown syntax (code blocks, tables, blockquotes, lists, etc.).
  Auto-generates cover page, table of contents, and headers/footers.
  Use cases: technical documentation, white papers, tutorials, reports — any Markdown document requiring professional typesetting.
---

# Markdown to PDF Skill

Convert Markdown documents into professional Apple-design-style PDF white papers.

## Core Features

1. **Professional typesetting**: Book-quality layout with automatic handling of page breaks and widow/orphan control
2. **Apple design language**: SF font system, modern minimalist style, professional colour palette
3. **Full table of contents**: Automatically extracts chapter structure, dual-column layout, clickable page jumps
4. **Complete Markdown support**: Code blocks, tables, blockquotes, lists — all rendered correctly

## How to Use

### Basic Usage

```bash
# Convert a single file
python scripts/convert.py input.md

# Specify output filename
python scripts/convert.py input.md -o "My White Paper.pdf"

# Custom title and author
python scripts/convert.py input.md --title "Technical White Paper" --author "Huashu"

Markdown Document Requirements

Your Markdown document should follow this structure:

# Document Title

## 1. Chapter One
### 1.1 Section One
### 1.2 Section Two

## 2. Chapter Two
### 2.1 Section One

Key rules:

  • Main chapters: ## 1. Title (number + full stop + space + title)
  • Sub-sections: ### 1.1 Title (number.number + space + title)
  • This structure is required for the table of contents to generate correctly

Design Features

Cover Design

  • Light grey gradient background
  • Large title: 64pt, clean and modern
  • Subtitle and metadata information

Table of Contents Design

  • Dual-column layout, fits on one page
  • Main chapters in bold, sub-sections indented
  • Clickable links that jump to the corresponding section

Body Typesetting

  • SF font family (Apple design language)
  • Line height 1.7 for comfortable reading
  • Chapters automatically start on a new page
  • Widow and orphan control

Code Blocks

  • Light grey background + fine border
  • 8px border radius
  • SF Mono monospace font
  • Automatic page break prevention

Tables

  • Clear grid lines
  • Light grey header row
  • Automatic header repeat (for tables that span multiple pages)

Configuration Options

To customise the style, edit the CSS variables in scripts/convert.py:

# Primary colour
PRIMARY_COLOR = '#06c'      # Apple blue
TEXT_COLOR = '#1d1d1f'      # Main text black
GRAY_COLOR = '#86868b'      # Light grey

# Font sizes
COVER_TITLE_SIZE = '64pt'
H2_SIZE = '22pt'
H3_SIZE = '17pt'
BODY_SIZE = '11pt'

Frequently Asked Questions

Q: Why is the table of contents empty?

A: Ensure your Markdown uses the correct chapter format:

  • ## 1. Title instead of ## Title
  • ### 1.1 Title instead of ### Title

Q: Code blocks not displaying correctly?

A: Ensure you're wrapping with three backticks:

```python
def hello():
    print("Hello")
```text

Q: Table formatting is broken?

A: Use standard Markdown table syntax:

| Column 1 | Column 2 |
|----------|----------|
| Value 1  | Value 2  |

Q: How do I change the font?

A: Edit the CSS in scripts/convert.py and modify the font-family property.

Q: The generated PDF is too large?

A: Check whether there are large images — consider compressing them or using external links.

Dependency Installation

First-time use requires installing Python dependencies:

pip3 install markdown2 weasyprint

If you encounter WeasyPrint installation issues (macOS):

brew install pango
pip3 install weasyprint

Examples

Generate Technical Documentation

python scripts/convert.py tech-guide.md -o "Technical Guide.pdf"

Generate a White Paper

python scripts/convert.py whitepaper.md --title "Product White Paper" --author "Team"

Script Reference

  • scripts/convert.py — Main conversion script
  • scripts/styles.css — CSS style definitions (embedded in script)
  • templates/cover.html — Cover template (embedded in script)

Technical Implementation

This Skill uses:

  • markdown2: Markdown parsing (with extended syntax support)
  • WeasyPrint: HTML to PDF conversion (with CSS3 support)
  • Apple design system: SF fonts, professional colour palette, modern typesetting

Changelog

v1.0 (2025-12-24)

  • Initial release
  • Full Markdown syntax support
  • Apple design style
  • Automatic table of contents generation
  • Book-quality typesetting

By Huashu | AI Native Coder · Independent Developer WeChat Official Account "Huashu" | 300k+ followers | AI Tools & Productivity Flagship products: Kitty Catchlight (AppStore Paid Rankings Top 1) · Play DeepSeek with One Book .Trim() if ($cell -match '^:?-+:? | Value 1 | Value 2 |


### Q: How do I change the font?

A: Edit the CSS in `scripts/convert.py` and modify the `font-family` property.

### Q: The generated PDF is too large?

A: Check whether there are large images — consider compressing them or using external links.

## Dependency Installation

First-time use requires installing Python dependencies:

```bash
pip3 install markdown2 weasyprint

If you encounter WeasyPrint installation issues (macOS):

brew install pango
pip3 install weasyprint

Examples

Generate Technical Documentation

python scripts/convert.py tech-guide.md -o "Technical Guide.pdf"

Generate a White Paper

python scripts/convert.py whitepaper.md --title "Product White Paper" --author "Team"

Script Reference

  • scripts/convert.py — Main conversion script
  • scripts/styles.css — CSS style definitions (embedded in script)
  • templates/cover.html — Cover template (embedded in script)

Technical Implementation

This Skill uses:

  • markdown2: Markdown parsing (with extended syntax support)
  • WeasyPrint: HTML to PDF conversion (with CSS3 support)
  • Apple design system: SF fonts, professional colour palette, modern typesetting

Changelog

v1.0 (2025-12-24)

  • Initial release
  • Full Markdown syntax support
  • Apple design style
  • Automatic table of contents generation
  • Book-quality typesetting

By Huashu | AI Native Coder · Independent Developer WeChat Official Account "Huashu" | 300k+ followers | AI Tools & Productivity Flagship products: Kitty Catchlight (AppStore Paid Rankings Top 1) · Play DeepSeek with One Book ) { " $cell " } else { " $cell " } } '|' + ($fixedCells -join '|') + '|'

| Value 1 | Value 2 |


### Q: How do I change the font?

A: Edit the CSS in `scripts/convert.py` and modify the `font-family` property.

### Q: The generated PDF is too large?

A: Check whether there are large images — consider compressing them or using external links.

## Dependency Installation

First-time use requires installing Python dependencies:

```bash
pip3 install markdown2 weasyprint

If you encounter WeasyPrint installation issues (macOS):

brew install pango
pip3 install weasyprint

Examples

Generate Technical Documentation

python scripts/convert.py tech-guide.md -o "Technical Guide.pdf"

Generate a White Paper

python scripts/convert.py whitepaper.md --title "Product White Paper" --author "Team"

Script Reference

  • scripts/convert.py — Main conversion script
  • scripts/styles.css — CSS style definitions (embedded in script)
  • templates/cover.html — Cover template (embedded in script)

Technical Implementation

This Skill uses:

  • markdown2: Markdown parsing (with extended syntax support)
  • WeasyPrint: HTML to PDF conversion (with CSS3 support)
  • Apple design system: SF fonts, professional colour palette, modern typesetting

Changelog

v1.0 (2025-12-24)

  • Initial release
  • Full Markdown syntax support
  • Apple design style
  • Automatic table of contents generation
  • Book-quality typesetting

By Huashu | AI Native Coder · Independent Developer WeChat Official Account "Huashu" | 300k+ followers | AI Tools & Productivity Flagship products: Kitty Catchlight (AppStore Paid Rankings Top 1) · Play DeepSeek with One Book

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.