mdtopdf: Exporting Markdown to Well-Formatted PDFs within an Agent

Introduction

Writing documentation in Markdown is convenient, but when you need to hand it over to colleagues for printing, archiving, or external distribution, you often have to convert it to PDF. Setting up Pandoc yourself, tweaking CSS, and handling Chinese fonts can take a lot of time; if you want an Agent to complete “read .md → produce PDF” directly in a conversation, you need a stable, reusable set of operational guidelines. Below we introduce the community Skill mdtopdf on SkillHub, which encapsulates the Markdown-to-PDF workflow into instructions that an Agent can follow. It is suitable for enabling in environments that support Skills, such as Cursor and Claude Code.

What is this

mdtopdf (coordinates @user_1ae97d99/mdtopdf, version 1.0.0) is a community Skill under the SkillHub category office-efficiency (subcategories include document processing and PDF processing), maintained by publisher 大森 (user_1ae97d99). The official summary is: a skill that converts md to pdf; the detailed description indicates that the Skill uses Python’s md2pdf library with WeasyPrint as the rendering engine to convert Markdown into a well-formatted PDF, emphasizing layout optimization, code syntax highlighting, page-break layout, and Chinese font support. The tag requires_api_key=false means no additional API Key configuration is needed when using it.

Skill page: https://www.skillhub.cn/skills/user_1ae97d99/mdtopdf
API coordinates: https://api.skillhub.cn/user_1ae97d99/mdtopdf

Core Features

According to the description on the SkillHub page, mdtopdf primarily covers the following capabilities (all official descriptions, not third-party inferences):

  1. Markdown → PDF: Exports a Markdown source file or content as a PDF document.
  2. Publishing-grade layout: Generates a fairly complete typeset PDF via md2pdf + WeasyPrint, including syntax highlighting and reasonable page breaks.
  3. Chinese scenarios: The description explicitly mentions support for Chinese fonts, facilitating the export of Chinese technical documents and instructional manuscripts.
  4. Trigger semantics: When a user mentions intents such as generating a PDF, exporting a document, printing Markdown, markdown to PDF / md to pdf, or PDF report, the Agent should prioritize enabling this Skill.

Platform-side data (based on the SkillHub page and fetched information): rating 100000, 734 downloads, 2 installations.

Installation and Activation

The installation follows the official SkillHub documentation SkillHub Installation and Priority Source Configuration. First do a CLI check, then install the Skill into the skills directory that the current Agent actually reads (the Agent will not load it if installed in the wrong directory).

1. Check whether the skillhub CLI is installed

command -v skillhub && skillhub --version

If it is not installed, you can follow the official documentation to perform the full installation (the example below is the recommended command from the documentation):

curl -fsSL https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/install.sh | bash

2. Install mdtopdf into the corresponding Agent’s skills directory

The documentation requires that --dir must be used during installation and must point to the skills path of the current environment. Common paths are as follows (excerpted from the official installation documentation):

Environment skills directory
Cursor ~/.cursor/skills/
Claude Code ~/.claude/skills/
Codex ~/.codex/skills/ or .agents/skills/ under the project

Installation command example (replace <skills directory> with the actual path from the table above):

skillhub install user_1ae97d99/mdtopdf --dir <skills directory>

You can also search for mdtopdf or the coordinates user_1ae97d99/mdtopdf within SkillHub and install it according to the page prompts. After installation, refresh or restart the Agent as required by your client so that the Skill is reloaded.

Typical Usage

This Skill follows the general SKILL.md format: once enabled, when the Agent recognizes a need to “produce a PDF from Markdown”, it will call the md2pdf / WeasyPrint related workflow according to the steps inside the Skill (the specific commands and dependencies are subject to the SKILL.md inside the installed package).

In conversations, you can describe your needs in ways that match the official trigger descriptions:

  1. Specify a local file: “Export README.md to PDF for printing.”
  2. Specify a content scenario: “Generate an externally shareable PDF from this technical description’s Markdown.”
  3. Use common English expressions: “export to PDF”, “generate PDF”, “markdown to PDF”, etc.

Before executing, the Agent should confirm the input path or Markdown content and the output PDF path, and complete the conversion when the local machine has the Python and WeasyPrint runtime environment required by the Skill. If the environment is missing, it should install according to the dependency instructions in SKILL.md rather than skipping font or engine configuration.

Applicable Scenarios and Notes

Who it’s for

  • Developers or technical writers who frequently write Markdown documents and occasionally need PDF delivery.
  • Users who want to complete “export to PDF” in natural language within an IDE like Cursor, rather than writing conversion scripts manually every time.
  • Chinese PDF scenarios that require code block highlighting, basic layout, and Chinese font support (with the Skill’s official description as the boundary).

Usage notes

  • Community source: source: community, verified: false. Before using, check the version and description on the SkillHub page and assess whether it can be used in a production environment.
  • Local dependencies: WeasyPrint and md2pdf usually depend on system libraries and Python packages; installation steps differ across operating systems, so the documentation inside the Skill package should be followed.
  • Installation directory: If --dir is not used to point to the Agent’s skills directory, the Skill may be installed under ./skills/ in the current directory and will not be recognized.
  • Download and installation data: The page shows 734 downloads and 2 installations; if the direct CLI installation fails, use the SkillHub site status as the reference, and obtain installation instructions again from the web page if necessary.

Conclusion

mdtopdf consolidates “Markdown to PDF” into an Agent-executable Skill: based on md2pdf and WeasyPrint, it addresses common needs such as layout, highlighting, and Chinese fonts, and requires no API Key. If you are already using Cursor or Claude Code to manage Skills, you can install it into the corresponding directory using the commands above, and trigger it with a single sentence when you need to export a document.

Official page: https://www.skillhub.cn/skills/user_1ae97d99/mdtopdf

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye