md-to-pdf — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited md-to-pdf (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
以下のツールがすでにインストール済みであることを確認済み:
pandoc 3.1.3(Markdown の中核変換エンジン)xelatex(日本語対応 LaTeX エンジン)wkhtmltopdf(HTML → PDF 変換)xeCJK パッケージ(LaTeX 日本語組版)Noto Serif CJK JP / Noto Sans CJK JP)インストール済みパッケージ(セッション内で apt install 実行済み):
texlive-lang-cjk # xeCJK.sty を含む
lmodern # lmodern.sty(pandoc テンプレート依存)Markdown
├─► HTML ──► wkhtmltopdf ──► PDF (スタイル重視・CSS制御)
├─► LaTeX(.tex) (数式・学術文書向け)
└─► xelatex ──────────────► PDF (日本語組版・数式両対応)pandoc input.md -o output.html --standalonepandoc input.md -o output.html \
--standalone \
--metadata title="文書タイトル" \
--css=style.css/* style.css */
body {
font-family: "Noto Serif CJK JP", "Noto Sans CJK JP", serif;
margin: 2cm;
line-height: 1.8;
font-size: 12pt;
color: #1a1a1a;
}
h1 { font-size: 22pt; border-bottom: 2px solid #333; padding-bottom: 6px; }
h2 { font-size: 16pt; color: #2c3e50; }
h3 { font-size: 13pt; color: #34495e; }
table { border-collapse: collapse; width: 100%; margin: 1em 0; }
td, th { border: 1px solid #ccc; padding: 6px 10px; }
th { background: #f0f0f0; }
code { background: #f5f5f5; padding: 2px 5px; border-radius: 3px; font-size: 90%; }
pre { background: #f5f5f5; padding: 12px; border-radius: 5px; overflow-x: auto; }
blockquote { border-left: 4px solid #ccc; margin-left: 0; padding-left: 1em; color: #555; }# HTML → PDF
wkhtmltopdf --encoding utf-8 \
--page-size A4 \
--margin-top 20mm --margin-bottom 20mm \
--margin-left 20mm --margin-right 20mm \
input.html output.pdf# Step 1: Markdown → HTML
pandoc input.md -o /tmp/work.html \
--standalone \
--css=style.css
# Step 2: HTML → PDF
wkhtmltopdf --encoding utf-8 \
--page-size A4 \
/tmp/work.html output.pdf# スタンドアロン .tex ファイルを生成
pandoc input.md -o output.tex \
--standalone \
-V CJKmainfont="Noto Serif CJK JP"# デフォルトテンプレートを取得してカスタマイズ
pandoc -D latex > my_template.tex
# my_template.tex を編集後:
pandoc input.md -o output.tex --template=my_template.texpandoc input.md -o output.pdf \
--pdf-engine=xelatex \
-V documentclass=article \
-V geometry=margin=2.5cm \
-V fontsize=11pt \
-V CJKmainfont="Noto Serif CJK JP" \
-V lang=ja| オプション | 説明 |
|---|---|
--pdf-engine=xelatex | xelatex を使用(日本語必須) |
-V documentclass=article | 文書クラス(article / report / book) |
-V geometry=margin=2.5cm | 余白設定 |
-V CJKmainfont="Noto Serif CJK JP" | 日本語メインフォント |
-V CJKsansfont="Noto Sans CJK JP" | 日本語サンズフォント |
-V fontsize=11pt | 基本フォントサイズ |
-V lang=ja | 言語設定 |
--toc | 目次を生成 |
--number-sections | セクション番号を付与 |
-V papersize=a4 | 用紙サイズ(a4 / letter) |
---
title: "文書タイトル"
author: "著者名"
date: "2026年5月"
lang: ja
geometry: margin=2.5cm
fontsize: 11pt
CJKmainfont: "Noto Serif CJK JP"
---#!/usr/bin/env python3
"""md_to_pdf.py: Markdown → PDF/HTML/LaTeX 変換スクリプト"""
import subprocess
import sys
from pathlib import Path
def md_to_pdf_xelatex(input_md: str, output_pdf: str, **kwargs):
"""Markdown → PDF(xelatex 経由・日本語対応)"""
cmd = [
"pandoc", input_md, "-o", output_pdf,
"--pdf-engine=xelatex",
"-V", "documentclass=article",
"-V", f"geometry=margin={kwargs.get('margin', '2.5cm')}",
"-V", f"fontsize={kwargs.get('fontsize', '11pt')}",
"-V", f"CJKmainfont={kwargs.get('cjk_font', 'Noto Serif CJK JP')}",
"-V", "lang=ja",
]
if kwargs.get("toc"):
cmd.append("--toc")
if kwargs.get("number_sections"):
cmd.append("--number-sections")
result = subprocess.run(cmd, capture_output=True, text=True)
if result.returncode != 0:
print(f"Error: {result.stderr}", file=sys.stderr)
return False
return True
def md_to_html(input_md: str, output_html: str, css: str = None, title: str = ""):
"""Markdown → HTML(スタンドアロン)"""
cmd = ["pandoc", input_md, "-o", output_html, "--standalone"]
if title:
cmd += ["--metadata", f"title={title}"]
if css:
cmd += ["--css", css]
result = subprocess.run(cmd, capture_output=True, text=True)
return result.returncode == 0
def md_to_pdf_via_html(input_md: str, output_pdf: str, css: str = None):
"""Markdown → HTML → PDF(wkhtmltopdf 経由)"""
tmp_html = "/tmp/_md_to_pdf_tmp.html"
if not md_to_html(input_md, tmp_html, css=css):
return False
cmd = [
"wkhtmltopdf", "--encoding", "utf-8",
"--page-size", "A4",
"--margin-top", "20mm", "--margin-bottom", "20mm",
"--margin-left", "20mm", "--margin-right", "20mm",
tmp_html, output_pdf
]
result = subprocess.run(cmd, capture_output=True, text=True)
return result.returncode == 0
def md_to_latex(input_md: str, output_tex: str):
"""Markdown → LaTeX(.tex ファイル)"""
cmd = [
"pandoc", input_md, "-o", output_tex,
"--standalone",
"-V", "CJKmainfont=Noto Serif CJK JP",
]
result = subprocess.run(cmd, capture_output=True, text=True)
return result.returncode == 0xelatex ルートで CJKmainfont を明示する:
pandoc input.md -o output.pdf \
--pdf-engine=xelatex \
-V CJKmainfont="Noto Serif CJK JP"wkhtmltopdf ルートでフォントが表示されない場合は CSS で指定:
body { font-family: "Noto Serif CJK JP", sans-serif; }lmodern.sty が見つからないapt-get install -y lmodernxeCJK.sty が見つからないapt-get install -y texlive-lang-cjk! Emergency stop. エラー原因は不足パッケージが多い。以下をインストール:
apt-get install -y texlive-lang-cjk lmodern texlive-xetex| 目的 | 推奨ルート |
|---|---|
| 日本語文書 + 数式 | Markdown → xelatex → PDF |
| デザイン重視・CSS制御 | Markdown → HTML → wkhtmltopdf → PDF |
| 学術論文・カスタム組版 | Markdown → LaTeX → xelatex → PDF |
| Web公開用 HTML | Markdown → pandoc → HTML |
| 簡易確認用 PDF | Markdown → wkhtmltopdf → PDF |
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.