← 返回 Skills 市场
earl-chen

Chrome Markdown to PDF

作者 Earl-chen · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
69
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install chrome-markdown2pdf
功能描述
使用 Chrome headless 将 Markdown 文件转为排版精美的 PDF,支持表格、代码块、中文。 Activate when user mentions: md转pdf、markdown转pdf、转PDF、导出PDF、生成PDF、chrome转pdf。
使用说明 (SKILL.md)

Markdown 转 PDF 工具

将 Markdown 文件转为带样式的 PDF,排版支持标题、表格、代码块、引用等。

使用方法

python3 ~/.openclaw/workspace/skills/chrome-markdown2pdf/scripts/md2pdf.py \
  --input "/path/to/file.md" \
  --output "/path/to/output.pdf"

如果不指定 --output,默认输出到输入文件同目录,后缀改为 .pdf

参数

参数 必填 说明
--input / -i 输入 Markdown 文件路径
--output / -o 输出 PDF 路径(默认同目录替换后缀)

依赖

  • Google Chrome(headless 模式渲染 PDF)

检查是否安装:

google-chrome --version

转换流程

  1. Markdown → HTML(内置转换器,支持表格、代码块、标题、加粗、斜体、行内代码、引用)
  2. HTML → PDF(Chrome headless --print-to-pdf

PDF 样式

  • 中文字体:Microsoft YaHei / PingFang SC
  • 表格带边框和斑马纹
  • 代码块灰色背景
  • 标题彩色层级(H1黑色/H2蓝色/H3绿色/H4紫色)

示例

# 基本用法
python3 ~/.openclaw/workspace/skills/chrome-markdown2pdf/scripts/md2pdf.py \
  -i /home/robot-01/work/report.md

# 指定输出路径
python3 ~/.openclaw/workspace/skills/chrome-markdown2pdf/scripts/md2pdf.py \
  -i /home/robot-01/work/report.md \
  -o /tmp/output.pdf
安全使用建议
This skill appears to honestly implement Markdown→PDF conversion using a local Chrome headless process and does not ask for credentials. Before installing, ensure you have a trusted Chrome/Chromium binary available (the script calls 'google-chrome'); the registry metadata should ideally list that binary as a requirement. Review and run the included script in a safe environment if you have concerns, and remember the script will read the Markdown file you point it to and write the resulting PDF to the specified location.
功能分析
Type: OpenClaw Skill Name: chrome-markdown2pdf Version: 1.0.0 The script `scripts/md2pdf.py` is vulnerable to HTML injection because it fails to sanitize Markdown input before rendering it via headless Chrome. Specifically, the `md_to_html` and `inline_format` functions do not escape HTML entities, allowing raw HTML tags or scripts in a Markdown file to be executed by the Chrome renderer. This could be exploited to perform local file disclosure or SSRF if the agent processes untrusted Markdown content. While the behavior aligns with the stated purpose and lacks evidence of intentional malice, the lack of input sanitization is a significant security flaw.
能力评估
Purpose & Capability
The name/description and included script both implement Markdown→HTML→PDF via Chrome headless, which matches the stated purpose. Minor incoherence: registry metadata lists no required binaries, but SKILL.md and the script require a local 'google-chrome' binary (Chrome headless) to render PDF.
Instruction Scope
SKILL.md instructs running the provided Python script on local files in the workspace; the script only reads the specified Markdown file, writes a temporary HTML file and the output PDF, and invokes Chrome to print the PDF. It does not access environment variables, network endpoints, or other system configuration beyond invoking 'google-chrome' and deleting the temp file.
Install Mechanism
There is no install spec (instruction-only plus a local script). No external downloads or archives; the only runtime dependency is a system Chrome/Chromium binary. This is low-risk from an install perspective.
Credentials
The skill requests no environment variables, credentials, or config paths. The script operates on user-specified input/output file paths and does not attempt to read secrets or unrelated config.
Persistence & Privilege
always is false and the skill does not request persistent/system-wide changes. It does not modify other skills or global agent settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install chrome-markdown2pdf
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /chrome-markdown2pdf 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
chrome-markdown2pdf 1.0.0 - 首次发布:将 Markdown 文件通过 Chrome headless 渲染为排版美观的 PDF,全面支持表格、代码块、中文和多样样式。 - 支持命令行参数指定输入(必填)和输出路径。 - 自动转换 Markdown 为带样式的 PDF,输出包含优化的中文字体和自定义样式(如表格斑马纹、代码块灰底、彩色标题)。 - 要求已安装 Google Chrome,可使用 `google-chrome --version` 检查安装情况。 - 提供命令行使用示例和参数说明,便于上手。
元数据
Slug chrome-markdown2pdf
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Chrome Markdown to PDF 是什么?

使用 Chrome headless 将 Markdown 文件转为排版精美的 PDF,支持表格、代码块、中文。 Activate when user mentions: md转pdf、markdown转pdf、转PDF、导出PDF、生成PDF、chrome转pdf。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 69 次。

如何安装 Chrome Markdown to PDF?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install chrome-markdown2pdf」即可一键安装,无需额外配置。

Chrome Markdown to PDF 是免费的吗?

是的,Chrome Markdown to PDF 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Chrome Markdown to PDF 支持哪些平台?

Chrome Markdown to PDF 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Chrome Markdown to PDF?

由 Earl-chen(@earl-chen)开发并维护,当前版本 v1.0.0。

💬 留言讨论