Borrowing it
Nothing to install: this file belongs to gatelynch/llm-knowledge-base. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/gatelynch/llm-knowledge-base/main/.claude/commands/convert-to-md.mdgit clone --depth 1 https://github.com/gatelynch/llm-knowledge-baseWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/gatelynch/llm-knowledge-base/convert-to-md)<a href="https://agentmods.dev/commands/gatelynch/llm-knowledge-base/convert-to-md"><img src="https://agentmods.dev/badge/commands/gatelynch/llm-knowledge-base/convert-to-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/gatelynch/llm-knowledge-base/convert-to-md"><img src="https://agentmods.dev/badge/commands/gatelynch/llm-knowledge-base/convert-to-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00025 | $0.03099 |
| Opus 5.5 | $0.00010 | $0.01240 |
| Sonnet 5.5 | $0.00005 | $0.00620 |
| Haiku 4.5 | $0.00003 | $0.00310 |
Grade A, and why
convert-to-md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 270 lines — stays where its author put it; the contents beside it link to each section on GitHub.
轉檔:EPUB / PDF / DOCX / Facebook JSON → Obsidian Markdown
將電子書、報告、文件或社群平台匯出轉成乾淨的 Markdown。
| 來源格式 | 輸出位置 | 媒體位置 |
|---|---|---|
| EPUB / PDF / DOCX | raw/books/ |
raw/books/assets/ |
| Facebook JSON 匯出 | raw/notes/social/facebook/ |
raw/notes/social/facebook/assets/ |
輸入
$ARGUMENTS 為檔案或資料夾路徑。
- 單一檔案:轉換該檔案(支援
.epub、.pdf、.docx) - 資料夾(書籍):掃描資料夾內所有
.epub、.pdf、.docx,逐一轉換 - 資料夾(Facebook 匯出):偵測到
your_facebook_activity/子目錄時,自動走 Facebook 轉換路徑 - 若無提供,問使用者:「請提供要轉換的檔案或資料夾路徑」
流程
Step 0:確認環境
檢查必要工具,缺少則安裝或提示使用者:
pandoc --version 2>&1 | head -1 # EPUB、DOCX 都需要
python3 -c "import fitz; print('OK')" # PDF 需要 pymupdf
- pandoc 未安裝 → 提示:
brew install pandoc - pymupdf 未安裝 → 執行:
pip3 install pymupdf
Step 1:判斷輸入類型
# 判斷是檔案還是資料夾
if [ -d "$ARGUMENTS" ]; then
# 先檢查是否為 Facebook 匯出(含 your_facebook_activity/ 子目錄)
if [ -d "$ARGUMENTS/your_facebook_activity" ]; then
echo "FACEBOOK_EXPORT"
else
# 一般資料夾:列出所有支援的檔案
find "$ARGUMENTS" -maxdepth 1 -type f \( -iname "*.epub" -o -iname "*.pdf" -o -iname "*.docx" \)
fi
else
# 單一檔案
file "$ARGUMENTS"
fi
- 若偵測到 Facebook 匯出 → 跳至「Facebook JSON 路徑」
- 若為一般資料夾,列出找到的檔案清單,告訴使用者即將轉換哪些檔案,確認後逐一執行 Step 2-7
- 若為單一檔案 → 依副檔名走對應路徑
Step 2:提取書名與 metadata
| 格式 | 方法 |
|---|---|
| EPUB | pandoc metadata 或解壓讀 nav.xhtml |
fitz.open(path).metadata['title'] |
|
| DOCX | pandoc --metadata 或讀 docProps/core.xml |
若提取失敗,用檔名(去副檔名)當書名。
產出檔名:raw/books/{書名}.md
Step 3:轉換
EPUB 路徑
- pandoc 轉換(
--wrap=none避免斷行):
pandoc "$FILE" -t markdown --wrap=none --extract-media=raw/books/assets -o raw/books/{書名}_raw.md
-
後處理:
- 移除 pandoc 屬性:
{.class}、[]{#id}、::: div - 移除翻譯外掛殘留(
.immersive-translate-*、.notranslate) - 圖片路徑改為相對路徑
- 中英文間距統一(pangu spacing)
------→——- 移除行首殘留
][ - 移除索引頁和廣告頁
- 移除 pandoc 屬性:
-
圖片:加書名前綴避免衝突,更新 markdown 路徑
PDF 路徑
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2mo ago First seen · 270 lines · 25 tokens per session scan A 7fa90accf482
convert-to-md is a command published in the GitHub repository gatelynch/llm-knowledge-base (343 stars, last pushed 7mo ago), licensed MIT. It adds 25 tokens to every session and 3,099 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
convert-to-md compared with commands from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| convert-to-mdgatelynch/llm-knowledge-base | Command | 343 | 7mo ago | MIT | A | 25 | Claude Code |
| openeigenweltlabs/legalwork | Command | 132 | yesterday | MIT | A | 9 | Claude Code |
| brief-compliance-checkflonat/flonat-research | Command | 149 | 3d ago | MIT | A | 45 | Claude Code |
| docsnyldn/claude-octopus | Command | 4.4k | today | MIT | A | 13 | Claude Code |
| cti-report7onez/cti-expert | Command | 622 | 15d ago | none | A | 45 | Claude Code |
| render-figuresbraininahat/brains-in-a-hat | Command | 4 | 18d ago | MIT | A | 17 | Claude Code |
| cheatsheetOPTIMETA/PAIDEIA | Command | 92 | 3mo ago | MIT | B | 29 | Claude Code |