From jsphh-writing
Convert academic journals (PDF, Word, PowerPoint, Excel, images, audio) to structured Markdown using Microsoft MarkItDown
How this skill is triggered — by the user, by Claude, or both
Slash command
/jsphh-writing:journal-to-mdThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
此 Skill 使用 Microsoft MarkItDown 工具將各種格式的學術文獻轉換為結構化的 Markdown 格式,便於後續整理、閱讀與知識管理。
此 Skill 使用 Microsoft MarkItDown 工具將各種格式的學術文獻轉換為結構化的 Markdown 格式,便於後續整理、閱讀與知識管理。
首次使用時需要安裝 MarkItDown:
pip install markitdown
當使用者提供單一檔案路徑時:
from markitdown import MarkItDown
# 初始化轉換器
md = MarkItDown()
# 轉換檔案
result = md.convert("path/to/academic_paper.pdf")
# 儲存為 Markdown
output_path = "path/to/academic_paper.md"
with open(output_path, "w", encoding="utf-8") as f:
f.write(result.text_content)
當使用者提供資料夾路徑時:
import os
from pathlib import Path
from markitdown import MarkItDown
def batch_convert(input_folder, output_folder=None):
"""
批次轉換資料夾中的所有支援格式檔案
Args:
input_folder: 輸入資料夾路徑
output_folder: 輸出資料夾路徑(預設為輸入資料夾下的 markdown 子資料夾)
"""
md = MarkItDown()
# 設定輸出資料夾
if output_folder is None:
output_folder = os.path.join(input_folder, "markdown")
os.makedirs(output_folder, exist_ok=True)
# 支援的檔案格式
supported_extensions = ['.pdf', '.docx', '.pptx', '.xlsx', '.jpg', '.jpeg', '.png']
# 遍歷資料夾
converted_files = []
failed_files = []
for file_path in Path(input_folder).rglob('*'):
if file_path.suffix.lower() in supported_extensions:
try:
# 轉換檔案
result = md.convert(str(file_path))
# 產生輸出檔名
relative_path = file_path.relative_to(input_folder)
output_path = Path(output_folder) / relative_path.with_suffix('.md')
output_path.parent.mkdir(parents=True, exist_ok=True)
# 儲存 Markdown
with open(output_path, "w", encoding="utf-8") as f:
f.write(result.text_content)
converted_files.append(str(file_path))
except Exception as e:
failed_files.append((str(file_path), str(e)))
return converted_files, failed_files
轉換後可進一步分析 Markdown 結構,提取關鍵部分:
def extract_paper_sections(markdown_text):
"""
從轉換後的 Markdown 中提取學術論文的關鍵章節
Returns:
dict: 包含 abstract, introduction, method, results, discussion 等章節
"""
sections = {
'abstract': '',
'introduction': '',
'method': '',
'results': '',
'discussion': '',
'references': ''
}
# 使用正則表達式或簡單字串匹配提取章節
# 這部分可根據實際轉換結果調整
return sections
USER: 請將這篇論文轉換成 Markdown
[提供 PDF 路徑]
ASSISTANT:
1. 檢查 markitdown 是否已安裝
2. 使用 MarkItDown 轉換 PDF
3. 儲存為 .md 檔案
4. 回報轉換結果與輸出路徑
USER: 請將這個資料夾裡的所有論文都轉成 Markdown
[提供資料夾路徑]
ASSISTANT:
1. 掃描資料夾中的所有支援格式檔案
2. 批次轉換所有檔案
3. 在原資料夾下建立 markdown 子資料夾
4. 回報轉換統計(成功/失敗數量)
USER: 請將這篇論文轉成 Markdown 並同步到 Notion
ASSISTANT:
1. 轉換 PDF 為 Markdown
2. 提取論文關鍵資訊(標題、作者、摘要等)
3. 使用 Notion MCP 建立新頁面
4. 將 Markdown 內容寫入 Notion
5. 回報 Notion 頁面連結
轉換完成後,建議在 Markdown 檔案開頭加入 YAML frontmatter:
---
title: [論文標題]
authors: [作者列表]
year: [發表年份]
journal: [期刊名稱]
doi: [DOI]
converted_date: [轉換日期]
source_file: [原始檔案路徑]
---
# [論文標題]
[轉換後的內容]
MarkItDown 支援 OCR,可從圖片中提取文字:
# 轉換包含圖片的 PDF 或直接轉換圖片
result = md.convert("screenshot.png")
若學術會議有錄音檔,可轉錄為文字:
# 需要額外安裝語音識別套件
result = md.convert("conference_talk.mp3")
npx claudepluginhub jsphh7124/jsphh-writingCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.