本文へ移動
cccskills
無料GitHub で公開日本語紹介

markdown-to-word-mermaid

Mermaid図を含むMarkdownをWord文書に変換し、拡大・印刷しても鮮明なSVG図と表示互換性を補うPNG画像を埋め込んだDOCXを作成します。

原文原文の説明を見る

Export Markdown containing Mermaid code fences to Word (.docx) with embedded SVG diagrams and PNG fallbacks. Use when diagram sharpness, Office-compatible labels, or page-aware placement matters. Not for Word-to-Markdown conversion, editable Office shapes, or general slide creation.

github/awesome-copilotスター 40,562(GitHub 40,562 + cccskills 0)
連携ツールWord

実行スコア 未検証

インストール方法を見る

こんなときに便利

  • Mermaid入り手順書をWordにしたいとき
  • 印刷しても鮮明な図を含めたいとき
  • 縦長の図のページ配置を整えたいとき
  • SVGとPNG付きのDOCXを作りたいとき

日本語での紹介

できること

Mermaidのコードフェンスを含むMarkdownを、Word(.docx)文書に変換します。各図はSVGとして埋め込み、互換表示用に3倍解像度のPNGも保持するため、拡大や印刷時の鮮明さと、表示環境への配慮を両立できます。見出し、段落、リスト、表、引用、コードブロックなどもWordの内容に変換し、縦に長い図はページ内に収まるよう配置します。変換は付属スクリプトでローカルに行います。

こんなときに便利

Mermaid図を含む設計書、手順書、レポートをWord形式で提出したいときに向いています。図のラベルを印刷時にも読みやすく保ちたい場合や、長い図がページ途中で分割されるのを避けたい場合にも使えます。Word上で図形やコネクターを個別編集する用途には対応しません。

使い方の例

  • 「このMarkdownを、図の文字が鮮明なWord文書に変換してください」
  • 「出力先をreport.docxにして、Mermaid図を含めて書き出してください」
  • 「日本語フォントを指定して、この手順書をDOCXにしてください」

注意点

Python 3.10以降、指定パッケージ、Node.js、Mermaid CLI、Puppeteerで使えるローカルブラウザー、文書の文字を含むインストール済みフォントが必要です。Wordは生成時には不要ですが、SVG表示の確認にはSVG対応版が必要です。既存の出力ファイルは上書きせず、無効なMermaidやレンダリング失敗では変換を中止します。フォント置換や最終的なページ割りは閲覧環境で確認してください。

この紹介文は、公開されている SKILL.md をもとに AI(OpenAI Codex)が作成しました。正確な仕様は下の原文を確認してください。

資料チェック

SKILL.md の記述から、注意が要る操作と導入の前提を AI が確認しました。点数は実際に動かした結果(実行検証)だけで付けています。

安全面送信・削除・コマンド実行などの扱いが明示されているか
A良好既存出力を上書きせず、依存導入の了承と不審な図内容の確認を求める。
導入のしやすさ必要なツールや API キーが少ないか、書かれているか
B一部不足Python、指定パッケージ、Node.js、Mermaid CLI、ブラウザー、フォントが必要。

点数には入れていません。 2026年10月26日 時点で AI(OpenAI Codex)が判定しました。目安なので、入れる前に原文も確認してください。

評価が違うと思ったら、見直しを依頼する

どの項目が、なぜ違うと思うかを書いてください。ログインは不要です。内容を SKILL.md と照らし合わせて評価を作り直し、この欄に反映します。

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

含まれるファイル(6)

  • SKILL.md8.1 KB
  • assets/example.md1.3 KB
  • references/publication.md2.3 KB
  • scripts/markdown_to_word.py25.9 KB
  • scripts/requirements.txt73 B
  • tests/test_markdown_to_word.py25.5 KB

SKILL.md(原文)

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

Markdown to Word with Mermaid

Export technical documents without manually replacing Mermaid fences with screenshots. The bundled converter renders each diagram locally, embeds the SVG through Office OOXML relationships, and retains a 3x PNG fallback. Word is not required to generate the file; an SVG-capable Word version is needed to inspect vector rendering.

When to use

  • A design document, runbook, or report contains Mermaid code fences and must be delivered as DOCX.
  • Diagram labels must remain sharp when zoomed or printed.
  • A tall diagram needs page-aware placement rather than being split across pages.

For general Markdown-to-DOCX conversion with existing PNG images, a general converter such as md-to-docx may be simpler. This skill focuses on rendering and packaging Mermaid diagrams. SVG embedding does not create editable Word shapes, connectors, or text boxes.

Requirements and setup

  • Python 3.10+ and the packages in scripts/requirements.txt.
  • Node.js compatible with the chosen Mermaid CLI release, plus @mermaid-js/mermaid-cli.
  • A local browser usable by Puppeteer and an installed font covering the document's characters.
  • Default font: Noto Sans JP. Use --font-family to select another installed family.

Resolve paths relative to this skill's installation directory, not an assumed repository name. The examples below run from the skill directory. Use the user's selected Python environment (python, python3, or its absolute path).

Before installing dependencies, confirm the environment and obtain permission if required. Reuse an existing Mermaid CLI when available. Otherwise install it into a user-approved local tools directory, not globally:

python -m pip install -r scripts/requirements.txt
npm install --prefix ./run/mermaid-cli @mermaid-js/mermaid-cli

The local executable is ./run/mermaid-cli/node_modules/.bin/mmdc on POSIX and ./run/mermaid-cli/node_modules/.bin/mmdc.cmd on Windows. Keep installed dependencies out of the submitted skill package. Lock the selected dependency versions in the consuming project for reproducible installations.

On Windows the converter detects standard Chrome and Edge paths. For another browser location, set MERMAID_BROWSER_PATH to its absolute executable path:

$env:MERMAID_BROWSER_PATH = "C:\Program Files\Google\Chrome\Application\chrome.exe"

On POSIX, use export MERMAID_BROWSER_PATH=/absolute/path/to/browser, or use Puppeteer's installed browser. Do not disable the browser sandbox just to make a conversion pass.

Workflow

  1. Confirm the input Markdown file, output destination, and font. If no destination is provided, use the input path with a .docx extension.
  2. Check that the output does not exist. Never delete or overwrite an existing document; ask for a different destination.
  3. Run scripts/markdown_to_word.py. Preserve the user's diagram source and meaning. Do not silently repair invalid Mermaid.
  4. Check the generated package and, when Word is available, inspect the document visually. Report package checks and visual checks separately.

With mmdc on PATH:

python scripts/markdown_to_word.py input.md --output output.docx

Using a workspace-local CLI on Windows:

python scripts/markdown_to_word.py input.md --output output.docx --mermaid-cli ./run/mermaid-cli/node_modules/.bin/mmdc.cmd

Selecting an installed font:

python scripts/markdown_to_word.py input.md --output output.docx --font-family "Noto Sans JP" --timeout 120

For a reproducible example, convert assets/example.md to a new output path. It includes English and Japanese labels, multiple diagrams, and a tall diagram.

Conversion behavior

  • Headings, paragraphs, emphasis, lists (preserving ordered list start numbers and separate list boundaries), blockquotes, tables, and code blocks become Word content.
  • Each Mermaid fence renders to SVG and a 3x PNG with a per-command timeout (default: 120 seconds). Office SVG extensions reference the SVG; the normal image reference retains the PNG fallback, and drawing metadata (title and descr) includes the section heading or Mermaid accTitle/accDescr plus the diagram type.
  • Output DOCX files are staged and SVG-injected inside a temporary directory before moving to the destination path so failed runs never leave partial files behind.
  • The selected font is applied to Word paragraph styles and Mermaid's font configuration. Code runs use Consolas. Fonts are not embedded; unavailable fonts may be substituted.
  • htmlLabels: false is set globally and for flowcharts to avoid HTML foreignObject labels that Office may not display. Check actual SVG output for unsupported constructs.
  • Diagrams are centered, keep their aspect ratio, and use a non-splitting paragraph. Diagrams occupying at least 70% of the page body height start on a new page. Oversized diagrams are scaled to the page body height. Large diagrams generate a readability warning.
  • A simple single-line frontmatter title becomes the document title; other frontmatter fields are removed from the body. This is not a full YAML metadata parser.
  • Ordinary Markdown image links remain alt text and a source path or URL; they are not embedded. Raw HTML is reduced to text, not executed.

Stop conditions and limitations

  • Missing input, wrong extensions, an existing output, missing CLI, invalid Mermaid, rendering failure, or unusable SVG dimensions stop the conversion with an error.
  • The converter does not call an external rendering service or a separate AI API. Dependency installation and browser execution are not an offline sandbox. Review untrusted diagram content, including external resources, before rendering it.
  • Diagrams are not semantically editable Office objects. Word rendering, font substitution, and final pagination depend on the viewer and must be checked there.
  • A successfully created DOCX is not proof that every diagram label is readable. Split large diagrams in the source only with the user's approval.

Verification

Run the test suite from the skill directory:

python -m unittest discover -s tests -v

The ordinary suite mocks Mermaid rendering. To run the real-renderer test as well, set MERMAID_CLI to the CLI executable's absolute path, then run the command again. On Windows PowerShell:

$env:MERMAID_CLI = (Join-Path $env:APPDATA "npm\mmdc.cmd")
python -m unittest discover -s tests -v

That test renders the bundled sample and checks the resulting DOCX's SVG references, PNG fallbacks, labels, and drawing dimensions. It does not automate Word visual inspection.

Before reporting completion:

  • Count Mermaid fences and verify the same number of SVG parts and SVG image references in the DOCX.
  • Confirm PNG fallback references exist and no label foreignObject remains in the sample's SVGs.
  • In Word, inspect node names, branch labels, font, diagram placement, and page boundaries; check zoomed or printed output when sharpness matters.
  • If Word or the actual renderer was unavailable, state which checks were not performed.

For contribution scope, evaluation cases, and a draft submission description, see references/publication.md. That file is maintainer guidance, not permission to publish.

Gotchas

  • mmdc.cmd needs Windows command handling; pass its path with --mermaid-cli rather than rewriting the script.
  • A missing font can affect both PNG rendering and SVG display. Use a family installed on the rendering and viewing machines.
  • Keep the SVG and PNG paired. Replacing SVG with a screenshot defeats the vector-preserving workflow.
  • Package validation, renderer tests, agent-selection evaluation, and human visual acceptance are different checks.

レビュー

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

コメント

ログインなしで書き込めます。使ってみた感想、質問、動かなかった環境などを気軽にどうぞ。

まだコメントはありません。最初のコメントを書いてみませんか。

送信するとすぐに公開されます。メールアドレスや電話番号などの個人情報は書かないでください。URL は 2 つまでです。

0 / 1000 文字

このフォームは reCAPTCHA で保護されており、Google のプライバシーポリシーと利用規約が適用されます。

同じリポジトリのスキル

acquire-codebase-knowledge

無料概要あり

既存プロジェクトのコードや設定を調べ、技術構成・設計・規約・テスト・懸念点などを7つの文書に整理します。根拠のファイルと不明点も明記し、引き継ぎに役立てます。

  • 初めて触るコードの全体像を知りたいとき
  • プロジェクトの引き継ぎ資料作成
  • 設計資料と実装の違いを確認
github/awesome-copilot4.1万2026年10月29日 更新

acreadiness-assess

無料概要あり

リポジトリのAI活用準備度をAgentRCで評価し、9つの観点のスコアや改善案をHTMLにまとめます。組織独自の採点方針にも対応します。

  • AIエージェント導入前の準備度確認
  • 評価結果から改善の優先順位を決めたいとき
  • 組織独自の基準で採点したいとき
github/awesome-copilot4.1万2026年10月29日 更新

実際のコードから言語や開発ルールを読み取り、AIコーディングエージェント向けの指示ファイルを生成。プロジェクト全体や領域別にルールを整理します。

  • VS Code Copilot向け指示を作成
  • 開発ルールの変更を指示に反映
  • モノレポの領域別ルールを整理
github/awesome-copilot4.1万2026年10月29日 更新

acreadiness-policy

無料概要あり

AgentRCの準備度評価を、組織やチームの基準に合わせて調整します。チェックの重みや合格率、除外項目を設定し、CIでの合否判定にも使えます。

  • 組織共通の評価基準づくり
  • AI関連の整備状況だけを評価
  • チェックの重要度を調整したいとき
github/awesome-copilot4.1万2026年10月29日 更新

ad-campaign-analyzer

無料概要あり

広告の実績データから無駄な支出と成果の高い施策を見つけ、停止・増額・検証の候補を整理します。媒体をまたぐ予算配分の見直しやA/Bテストの評価にも使えます。

  • 停止すべき広告やキーワードの特定
  • 増額候補のキャンペーンや配信対象の発見
  • A/Bテスト結果の有意性を確認したいとき
github/awesome-copilot4.1万2026年10月29日 更新

add-educational-comments

無料概要あり

指定したコードファイルに、構文や設計の理由を説明する学習用コメントを追加します。読む人の知識に合わせて解説の深さや繰り返し、注釈番号の有無を調整できます。

  • 既存コードに初心者向け解説を付けたいとき
  • 構文や設計を選んだ理由の説明
  • 読み手の経験に合わせたコメント調整
github/awesome-copilot4.1万2026年10月29日 更新

github のスキルをすべて見る

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