本文へ移動
cccskills
無料GitHub で公開

md-to-docx

Convert Markdown files to Word documents (.docx) with proper formatting, Chinese font support (FangSong for all text including headings), black font color, 1.5x line spacing, precise first-line indent (24pt), heading spacing after (1 line), no italic headings, and automatic superscript conversion for citation numbers. Use when converting .md files to .docx, creating Word documents from markdown, or when user mentions Word, DOCX, or document conversion. Requires pandoc.

インストール方法を見る

含まれるファイル(10)

  • SKILL.md7.5 KB
  • chinese_template.docx26.7 KB
  • convert_md_to_docx.py18.8 KB
  • create_chinese_template.py9.9 KB
  • DISTRIBUTION.md4.4 KB
  • fix_heading_fonts.py2.6 KB
  • fix_tables.py6.6 KB
  • INSTALLATION.md2.6 KB
  • README.md4.7 KB
  • 快速使用指南.md3.7 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Markdown to Word (DOCX) Converter

Convert markdown files to professionally formatted Word documents (.docx) using pandoc.

What this Skill does

This Skill enables Claude to convert Markdown files to Word documents with proper formatting, including:

  • Headings and text formatting (H1-H6, bold, italic, strikethrough)
  • Lists (ordered and unordered, nested)
  • Tables with proper formatting
  • Images (automatically embedded)
  • Links and references
  • Code blocks and inline code
  • Chinese punctuation preservation (。,""();!?)
  • Citation superscript: Automatically converts citation numbers (e.g., 文献1。 → 文献¹。) to superscript format for academic documents
  • Default Chinese template: Uses FangSong (仿宋) font for all Chinese text (body, headings, and subtitles), Times New Roman for English text, black color for all text, 1.5x line spacing, first-line indent of two characters (24pt, precisely aligned), heading spacing after (1 line / 12pt), and no italic style for headings

Requirements

Packages must be installed in your environment before using this Skill:

pandoc (required):

# macOS
brew install pandoc

# Linux (Debian/Ubuntu)
sudo apt-get install pandoc

# Windows
choco install pandoc

python-docx (required for template creation):

pip install python-docx

Verify pandoc installation:

pandoc --version

Instructions

When the user requests to convert a Markdown file to Word format:

  1. Check if pandoc is installed by running pandoc --version

    • If not installed, guide the user to install it (see Requirements section)
  2. Identify the input and output files

    • Ask for clarification if the user hasn't specified the output filename
    • Use meaningful names (e.g., if input is report.md, suggest report.docx)
  3. Run the conversion script using the Bash tool:

    python .claude/skills/md-to-docx/convert_md_to_docx.py input.md output.docx
    
  4. Use additional options as needed:

    • Add --toc for table of contents (default: no TOC)
    • Add --no-chinese-template if user doesn't want FangSong font
    • Add --no-superscript-citations to disable automatic citation superscript conversion
    • Add --reference-doc template.docx for custom styling
    • Add --title, --author, --date for document metadata
  5. For batch conversions:

    python .claude/skills/md-to-docx/convert_md_to_docx.py --batch input_dir/ output_dir/
    
  6. Verify the conversion succeeded and inform the user of the output location

Default behavior: The script automatically uses a Chinese template with FangSong (仿宋) font for Chinese text unless --no-chinese-template is specified.

Examples

Convert a single file (uses default Chinese template):

python .claude/skills/md-to-docx/convert_md_to_docx.py "教育改革方案.md" "教育改革方案.docx"

Convert with table of contents (optional, default is no TOC):

python .claude/skills/md-to-docx/convert_md_to_docx.py report.md report.docx --toc

Convert with metadata:

python .claude/skills/md-to-docx/convert_md_to_docx.py paper.md paper.docx \
  --title "研究报告" \
  --author "张三" \
  --date "2025-11-20"

Batch convert all markdown files:

python .claude/skills/md-to-docx/convert_md_to_docx.py --batch ./markdown_files/ ./word_docs/

Use custom template for organizational styling:

python .claude/skills/md-to-docx/convert_md_to_docx.py doc.md doc.docx \
  --reference-doc company_template.docx

Supporting Files

This Skill includes additional resources:

  • README.md: Detailed usage guide with examples
  • 快速使用指南.md: Quick start guide in Chinese
  • convert_md_to_docx.py: Main conversion script with automatic post-processing
  • create_chinese_template.py: Utility to create custom Chinese templates
  • fix_heading_fonts.py: Post-processing script for font and spacing fixes
  • chinese_template.docx: Default Chinese font template (FangSong, 1.5x line spacing, heading spacing)

Troubleshooting

"pandoc: command not found"

  • Install pandoc using your package manager (see Requirements section)

Images not appearing in output

  • Ensure image paths in markdown are correct (use relative paths from markdown file location)
  • Verify image files exist at specified paths

Table formatting issues

  • Verify markdown table syntax:
    | Header 1 | Header 2 |
    |----------|----------|
    | Cell 1   | Cell 2   |
    

Script execution errors

  • Ensure script has execute permissions: chmod +x convert_md_to_docx.py
  • Use forward slashes in all file paths (Unix style)

Chinese Document Best Practices

When converting Chinese documents:

  1. Encoding: Ensure markdown files use UTF-8 encoding
  2. Punctuation: Use proper Chinese punctuation (。,""();!?)
  3. Font: Default template uses FangSong for all Chinese text (body, headings, and subtitles) with black color
  4. Line spacing: 1.5x line spacing for all paragraphs (符合中文文档标准)
  5. Paragraph formatting: First-line indent of two characters (24pt, precisely aligned) for proper Chinese document style
  6. Heading spacing: 1 line (12pt) spacing after all headings for better readability
  7. Heading style: All headings use FangSong font without italic style
  8. Custom templates: Create organizational templates with create_chinese_template.py

Command Line Options Reference

OptionDescription
input.mdInput Markdown file path
output.docxOutput Word document path
--tocGenerate table of contents (default: no TOC)
--no-chinese-templateDon't use default Chinese font template
--no-superscript-citationsDon't convert citation numbers to superscript
--reference-doc FILEUse custom Word template for styling
--title TEXTSet document title metadata
--author TEXTSet document author metadata
--date TEXTSet document date metadata
--batchEnable batch conversion mode
--pattern PATTERNFile pattern for batch mode (default: *.md)

Default Document Formatting

The Chinese template automatically applies:

  • Font: FangSong (仿宋) for Chinese text, Times New Roman for English
  • Font size: 12pt (body text)
  • Font color: Black for all text
  • Line spacing: 1.5x for all paragraphs
  • First-line indent: 24pt (2 Chinese characters)
  • Heading spacing: 12pt (1 line) after each heading
  • Heading style: Bold, no italic
  • Citation superscript: Numbers before sentence-ending punctuation (。;) are automatically converted to superscript (e.g., 参考文献1。 → 参考文献¹。). Only converts numbers 1-60 that directly follow Chinese characters or letters.
  • Table of contents: Not generated by default (use --toc to add)

For complete documentation, see README.md.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

a1

無料

VS-Enhanced Research Question Refiner - Prevents Mode Collapse and derives differentiated research questions Enhanced VS 3-Phase process: Modal question avoidance, alternatives presentation, differentiated RQ recommendation Use when: refining research ideas, formulating research questions, clarifying scope Triggers: research question, 연구 질문, PICO, SPIDER, research idea

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

a2

無料

VS-Enhanced Theoretical Framework Architect with Critique & Visualization Full VS 5-Phase process: Modal theory avoidance, Long-tail exploration, differentiated framework presentation Absorbed A3 (Devil's Advocate) critique and A6 (Conceptual Framework Visualizer) capabilities Use when: building theoretical foundations, designing conceptual models, deriving hypotheses, critiquing frameworks, visualizing models Triggers: theoretical framework, 이론적 프레임워크, conceptual model, 개념적 모형, hypothesis derivation, critique, devil's advocate, 반론, visualization, diagram

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

a5

無料

Agent A5 - Paradigm & Worldview Advisor - Philosophical foundations for research design. Covers ontology, epistemology, axiology, and methodology alignment. Use when: establishing philosophical foundations, justifying methodological choices, writing positionality statements Triggers: paradigm, 패러다임, ontology, epistemology, worldview, 세계관, philosophical foundations, 철학적 기초

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

Academic paper writing skill with 12-agent pipeline. v2.5: Style Calibration (learn author's writing voice from past papers) + Writing Quality Check (writing quality checklist for natural prose). Supports IMRaD, literature review, theoretical, case study, policy brief, and conference paper structures. APA 7.0 (default), Chicago, MLA, IEEE, Vancouver citation formats. Bilingual abstracts (zh-TW + EN). Multi-format output (LaTeX, DOCX, PDF, Markdown). Triggers on: write paper, academic paper, paper outline, write abstract, revise paper, check citations, convert to LaTeX, guide my paper, parse reviews, revision roadmap, 寫論文, 學術論文, 論文大綱, 寫摘要, 修改論文, 檢查引用, 引導我寫論文, 帶我規劃論文, 逐章規劃, 論文架構, 審查意見, 修訂路線圖.

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

Systematic writing framework for philosophy and interdisciplinary academic papers from optimized outline to submission-ready manuscript. Use when users want to: (1) write a paper from a detailed outline, (2) ensure quality control during writing, (3) maintain consistency across chapters, (4) prepare a submission-ready manuscript, or (5) systematically execute a planned paper. Triggered by phrases like 'write the paper from this outline,' 'compose the full manuscript,' 'execute the outline,' or when users have completed strategic planning (academic-paper-strategist skill) and are ready to write. Takes optimized outline as input; outputs complete manuscript with iterative quality checks.

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

Multi-perspective academic paper review with dynamic reviewer personas. Simulates 5 independent reviewers (EIC + 3 peer reviewers + Devil's Advocate) with field-specific expertise. Supports full review, re-review (verification), quick assessment, methodology focus, and Socratic guided modes. Triggers on: review paper, peer review, manuscript review, referee report, review my paper, critique paper, simulate review, editorial review.

日本語の概要は準備中です。原文の説明を表示しています。

brycewang-stanford/Auto-Empirical-Research-Skills4,5972026年10月12日 更新

brycewang-stanford のスキルをすべて見る

このスキルの問題を報告する