NotionページをMarkdownに変換するCLIツール。
npx @notion-md-converter/cli convert -p <PAGE_ID_OR_URL> -t <NOTION_TOKEN>
npm install -g @notion-md-converter/cli
APIキーを取得するには、Notionのスタートガイドに従ってください。
NotionページをMarkdownに変換して標準出力に表示:
npx @notion-md-converter/cli convert --page <PAGE_ID_OR_URL> --token <NOTION_TOKEN>
-
-p, --page <pageId>
: NotionページIDまたはURL(必須) -
-t, --token <token>
: Notion APIトークン(必須) -
-h, --help
: コマンドのヘルプを表示 -
-V, --version
: バージョン番号を出力
ページIDを使用:
npx @notion-md-converter/cli convert -p 12345678901234567890123456789012 -t secret_abc123
ページURLを使用:
npx @notion-md-converter/cli convert -p "https://www.notion.so/My-Page-12345678901234567890123456789012" -t secret_abc123
ファイルに保存:
npx @notion-md-converter/cli convert -p <PAGE_ID> -t <TOKEN> > output.md
環境変数を使用:
export NOTION_TOKEN="secret_abc123"
npx @notion-md-converter/cli convert -p <PAGE_ID> -t $NOTION_TOKEN
- Notion Developersにアクセス
- 「New integration」をクリック
- 名前を付けてワークスペースを選択
- 「Internal Integration Token」をコピー
- ページをインテグレーションと共有:
- Notionでページを開く
- 「共有」→「招待」をクリック
- インテグレーション名を検索して招待
CLIはページIDとURLの両方を受け入れます:
-
ページID:
12345678901234567890123456789012
-
ハイフン付きページID:
12345678-9012-3456-7890-123456789012
-
Notion URL:
https://www.notion.so/Page-Title-12345678901234567890123456789012
CLIは一般的な問題に対して明確なエラーメッセージを提供します:
- 無効なページIDまたはURL形式
- 無効または期限切れのNotion APIトークン
- ページが見つからない、またはアクセスが拒否された
- ネットワーク接続の問題
終了コード:
-
0
: 成功 -
1
: エラー発生
MITライセンスの下で配布されています。詳細はLICENSEを参照してください。
malvageee (https://github.com/salvage0707)