MarkdownをJSON ASTに変換

Markdownを単なる文字列入りJSONではなく、見出しやリストの階層を表す抽象構文木へ解析します。開発・検証向けのツールです。

Markdown入力

113 文字

JSONプレビュー

変換後のテキスト
[
  {
    "type": "heading",
    "children": [
      {
        "type": "inline",
        "content": "プロジェクトノート",
        "children": [
          {
            "type": "text",
            "content": "プロジェクトノート"
          }
        ]
      }
    ],
    "tag": "h1"
  },
  {
    "type": "paragraph",
    "children": [
      {
        "type": "inline",
        "content": "読みやすい文書は、**分かりやすい構造**から始まります。",
        "children": [
          {
            "type": "text",
            "content": "読みやすい文書は、"
          },
          {
            "type": "strong_open",
            "tag": "strong"
          },
          {
            "type": "text",
            "content": "分かりやすい構造"
          },
          {
            "type": "strong_close",
            "tag": "strong"
          },
          {
            "type": "text",
            "content": "から始まります。"
          }
        ]
      }
    ],
    "tag": "p"
  },
  {
    "type": "heading",
    "children": [
      {
        "type": "inline",
        "content": "確認すること",
        "children": [
          {
            "type": "text",
            "content": "確認すること"
          }
        ]
      }
    ],
    "tag": "h2"
  },
  {
    "type": "bullet_list",
    "children": [
      {
        "type": "list_item",
        "children": [
          {
            "type": "paragraph",
            "children": [
              {
                "type": "inline",
                "content": "見出しの階層",
                "children": [
                  {
                    "type": "text",
                    "content": "見出しの階層"
                  }
                ]
              }
            ],
            "tag": "p"
          }
        ],
        "tag": "li"
      },
      {
        "type": "list_item",
        "children": [
          {
            "type": "paragraph",
            "children": [
              {
                "type": "inline",
                "content": "正しく開くリンク",
                "children": [
                  {
                    "type": "text",
                    "content": "正しく開くリンク"
                  }
                ]
              }
            ],
            "tag": "p"
          }
        ],
        "tag": "li"
      },
      {
        "type": "list_item",
        "children": [
          {
            "type": "paragraph",
            "children": [
              {
                "type": "inline",
                "content": "再利用しやすいファイル",
                "children": [
                  {
                    "type": "text",
                    "content": "再利用しやすいファイル"
                  }
                ]
              }
            ],
            "tag": "p"
          }
        ],
        "tag": "li"
      }
    ],
    "tag": "ul"
  },
  {
    "type": "blockquote",
    "children": [
      {
        "type": "paragraph",
        "children": [
          {
            "type": "inline",
            "content": "ダウンロード前にプレビューを確認します。",
            "children": [
              {
                "type": "text",
                "content": "ダウンロード前にプレビューを確認します。"
              }
            ]
          }
        ],
        "tag": "p"
      }
    ],
    "tag": "blockquote"
  }
]
ファイルはこのブラウザタブ内で処理されます。

MarkdownのASTを確認する手順

各ノードの種類と入れ子を追うと、レンダラーが文書をどう解釈したか分かります。

01

Markdownを入力

解析したいソースを貼り付けるか、.mdファイルを開きます。

02

JSONを調べる

ノード種別、子要素、テキスト、リンク先などを確認します。

03

コピーまたは保存

JSONをコピーするか、開発用データとしてダウンロードします。

対応内容

文書を構造化データとして確認

Markdownの見た目ではなく、パーサーが認識した階層を出力します。

ノード種別見出し、段落、リスト、リンク、コードなどを種類別のノードにします。
入れ子を保持リスト項目や強調など、文書内の親子関係をJSONで表します。
機械処理しやすい変換パイプライン、検査ツール、カスタムレンダラーの入力に使えます。
活用例

JSON ASTの利用例

パーサーのデバッグ

期待と異なるレンダリングが、どのノード解釈から起きたか調べます。

コンテンツ変換

特定の見出しやリンクだけを抽出する処理の土台にします。

構造差分

文章の表面的な空白ではなく、文書構造の変更を比較します。

よくある質問

MarkdownからJSONへの変換について

通常のJSON文書に変換するツールですか?

いいえ。出力はMarkdownを解析したASTです。業務データのキーと値を自動生成するものではありません。

JSONをMarkdownに戻せますか?

現行ページはASTの確認と出力が中心です。任意のJSONからMarkdownを復元する機能ではありません。

どんな人向けですか?

Markdownパーサー、静的サイト生成、lint、独自変換を扱う開発者向けです。