gen-pdf
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "gen-pdf":https://skillpi.com/zh/skills/deepskill-adc616410e1534b9f42efc592fd56e57a037ccb625f493635b8628269d14f8fb。安装前核对上游来源和版本:https://github.com/antoniolg/agent-kit。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
将 Markdown 文件转换为带有 DevExpert 品牌样式的 PDF,右下角包含 Logo。用于将 Markdown 文档或 DevExpert 提案/文档导出为 PDF。
介绍来源: third_party · antoniolg · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
Frontmatter
name: gen-pdf
description: Converts a Markdown file to a styled PDF with DevExpert branding (logo in bottom-right corner). Use when asked to generate a PDF from a Markdown document, or when any DevExpert proposal/document needs to be exported as PDF.gen-pdf — Generador de PDFs con estilo Obsidian + DevExpert
Convierte cualquier fichero Markdown a PDF con un acabado visual cercano al export de Obsidian (tipografía y jerarquía neutras) y mantiene el logo de DevExpert en la esquina inferior derecha.
Cuándo usar esta skill
- El usuario pide generar un PDF a partir de un fichero
.md - Se acaba de crear o actualizar un documento/propuesta y hay que exportarlo
- El usuario pide añadir el logo de DevExpert a un PDF existente
Dependencias
pip install markdown-it-py[plugins] weasyprint reportlab PyPDF2
Rutas clave
- Logo DevExpert:
assets/devexpert-logo.png(logo horizontal completo, relativo a la carpeta de la skill) - Output por defecto:
~/Documents/aipal/40-archive/
Script de generación
Usa el siguiente script Python. Acepta input_md y output_pdf como variables:
import os
import tempfile
from pathlib import Path
from markdown_it import MarkdownIt
from PyPDF2 import PdfReader, PdfWriter
from reportlab.lib.pagesizes import A4
from reportlab.pdfgen import canvas
from weasyprint import CSS, HTML
md = MarkdownIt("commonmark", {"breaks": True, "html": True}).enable("table")
CSS_STYLES = """
@page {
size: A4;
margin: 30mm 24mm 26mm 24mm;
}
html, body {
margin: 0;
padding: 0;
color: #111111;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
font-size: 12pt;
line-height: 1.46;
}
p {
margin: 0 0 0.82em 0;
}
h1, h2, h3, h4 {
color: #111111;
font-weight: 800;
line-height: 1.12;
margin: 0;
}
h1 {
font-size: 24pt;
margin-bottom: 0.9em;
}
h2 {
font-size: 20pt;
margin-top: 1.1em;
margin-bottom: 0.74em;
}
h3 {
font-size: 16pt;
margin-top: 0.95em;
margin-bottom: 0.58em;
}
h4 {
font-size: 13pt;
margin-top: 0.8em;
margin-bottom: 0.4em;
}
strong {
color: #111111;
font-weight: 800;
}
ul, ol {
margin: 0.35em 0 0.9em 1.28em;
padding: 0;
}
li {
margin-bottom: 0.24em;
}
li::marker {
color: #a0a0a0;
}
table {
width: 100%;
border-collapse: collapse;
margin: 0.9em 0 1.1em 0;
font-size: 10.5pt;
}
th, td {
border: 1px solid #d4d4d4;
padding: 7px 10px;
text-align: left;
vertical-align: top;
}
th {
background: #f3f3f3;
color: #111111;
font-weight: 700;
}
tr:nth-child(even) td {
background: #fafafa;
}
blockquote {
border-left: 3px solid #d0d0d0;
padding-left: 12px;
color: #303030;
margin: 0.8em 0;
}
code {
font-family: "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
font-size: 0.9em;
background: #f5f5f5;
padding: 0.08em 0.28em;
border-radius: 4px;
}
pre code {
display: block;
white-space: pre-wrap;
padding: 0.8em;
}
a {
color: #111111;
text-decoration: underline;
text-decoration-color: #c1c1c1;
}
hr {
border: 0;
height: 0;
margin: 0;
padding: 0;
background: transparent;
page-break-after: always;
break-after: page;
}
"""
def resolve_logo_path(explicit_logo_path=None):
if explicit_logo_path:
explicit_path = Path(explicit_logo_path).expanduser()
if explicit_path.exists():
return explicit_path
candidates = []
env_logo = os.getenv("GEN_PDF_LOGO_PATH")
if env_logo:
candidates.append(Path(env_logo).expanduser())
skill_dir = os.getenv("GEN_PDF_SKILL_DIR")
if skill_dir:
candidates.append(Path(skill_dir).expanduser() / "assets" / "devexpert-logo.png")
candidates.extend(
[
Path.cwd() / "assets" / "devexpert-logo.png",
Path.home() / ".claude" / "skills" / "gen-pdf" / "assets" / "devexpert-logo.png",
]
)
for candidate in candidates:
if candidate.exists():
return candidate
return None
def gen_pdf(input_md, output_pdf, add_logo=True, logo_path=None):
input_md_path = Path(input_md).expanduser()
output_pdf_path = Path(output_pdf).expanduser()
output_pdf_path.parent.mkdir(parents=True, exist_ok=True)
content = input_md_path.read_text(encoding="utf-8")
html_content = md.render(content)
full_html = f"""<!doctype html>
<html>
<head><meta charset="utf-8" /></head>
<body>{html_content}</body>
</html>"""
HTML(string=full_html, base_url=str(input_md_path.parent)).write_pdf(
str(output_pdf_path), stylesheets=[CSS(string=CSS_STYLES)]
)
if not add_logo:
return
resolved_logo = resolve_logo_path(logo_path)
if not resolved_logo:
return
reader = PdfReader(str(output_pdf_path))
writer = PdfWriter()
with tempfile.NamedTemporaryFile(suffix=".pdf", delete=False) as temp_file:
temp_logo_pdf = temp_file.name
page_width, _ = A4
canvas_obj = canvas.Canvas(temp_logo_pdf, pagesize=A4)
canvas_obj.drawImage(
str(resolved_logo),
page_width - 128,
14,
width=110,
height=27,
mask="auto",
preserveAspectRatio=True,
)
canvas_obj.showPage()
canvas_obj.save()
logo_overlay_page = PdfReader(temp_logo_pdf).pages[0]
for page in reader.pages:
page.merge_page(logo_overlay_page)
writer.add_page(page)
with output_pdf_path.open("wb") as output_file:
writer.write(output_file)
os.unlink(temp_logo_pdf)
Instrucciones de uso
- Importa o copia la función
gen_pdfen un script temporal en/tmp/ - Llámala con
input_md= ruta al fichero Markdown youtput_pdf= ruta de salida - Mantén
add_logo=Truepara documentos DevExpert - Si ejecutas fuera de la carpeta de la skill, define
GEN_PDF_SKILL_DIRoGEN_PDF_LOGO_PATH - Tras generar, copia al directorio temporal de Telegram (
$TMPDIR/aipal/documents/) y responde con[[document:/ruta]]
Notas
- Los
---en el Markdown fuerzan salto de página en el PDF - Los saltos de línea simples se respetan (
breaks=True) - Las tablas Markdown se renderizan con estilo neutro
- Las imágenes referenciadas en el Markdown se resuelven con
base_urldel fichero de entrada - Para propuestas DevExpert, usa siempre el logo horizontal completo incluido en
assets/devexpert-logo.png, no el icono cuadrado.
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 提供 Markdown 转 PDF 功能,适用于文档导出、提案生成等明确场景
- 带有 DevExpert 品牌样式,满足特定品牌需求
亮点
- description 明确描述了使用场景,覆盖合理
亮点
- 文档结构清晰,包含使用场景、依赖、脚本、使用说明等
- frontmatter 完整,有完整示例和步骤
亮点
- 提供了完整的 Python 脚本,依赖明确,参数正确
- 覆盖主要异常(如 logo 路径解析),不可逆操作有确认机制
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
-
读取本地文件
限定到你选择的文件或项目目录;避免读取无关的个人资料、密钥和配置文件。
主文档提及 · 第 208 行 -
保存或修改文件
先确认输出目录和同名文件是否会被覆盖;重要文件保留备份,优先写入新的输出目录。
主文档提及 · 第 245 行 -
安装或获取外部依赖
使用官方来源并锁定版本,在隔离环境检查安装脚本。当前文档检查不覆盖后续下载的代码。
主文档提及 · 第 19 行
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。