0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

[Deno] Node.js をインストールせずに wordpress-export-to-markdown を使用する

Last updated at Posted at 2025-05-27

wordpress-export-to-markdown を用いることで WordPress のコンテンツを Markdown に変換出来ます。

参考「GitHub - lonekorean/wordpress-export-to-markdown: Converts a WordPress export XML file into Markdown files.

wordpress-export-to-markdown は npm パッケージのため従来は Node.js が必要でしたが、現在の Deno は Node.js と互換性があるため、Node.js をインストールせずに使用可能です。

(全ての Node.js 用のコードがそのまま Deno で動くとは限らないことに注意。)

参考「Node and npm Compatibility

Deno 自体のインストールは公式ドキュメント等を参照。

参考「Installation

1. 基本

WordPress の管理画面で、「ツール」>「エクスポート」から「すべてのコンテンツ」のエクスポートファイルを保存します。

ファイル名の例
WordPress.2025-05-01.xml

deno run で npm パッケージを実行します。

deno run --allow-read --allow-write --allow-net --allow-env npm:wordpress-export-to-markdown

参考「Quick Start - GitHub - lonekorean/wordpress-export-to-markdown: Converts a WordPress export XML file into Markdown files.

2. オプション

使用例
deno run --allow-read --allow-write --allow-net --allow-env npm:wordpress-export-to-markdown \
	--input=WordPress.2025-05-01.xml \
	--post-folders=false \
	--prefix-date=false \
	--date-folders=none \
	--save-images=all \
	--wizard=false \
	--output=converted \
	--frontmatter-fields=title,date,categories \
	--timezone=Asia/Tokyo

2.1. 基本

オプション デフォルト値 説明
--input export.xml 入力する WordPress エクスポートファイル
--post-folders true 投稿ごとにディレクトリを作成する
値: true, false
--prefix-date false ディレクトリまたはファイル名に日付プレフィックスを追加する
値: true, false
--date-folders none 日付ディレクトリを作成する
値: year, year‑month, none
--save-images all 画像をダウンロードする
値: attached, scraped, all, none

参考「Options - GitHub - lonekorean/wordpress-export-to-markdown: Converts a WordPress export XML file into Markdown files.

2.2. 詳細

オプション デフォルト値 説明
--wizard true 対話型で実行する
値: true, false
--output output 出力ディレクトリ
--frontmatter-fields title,
date,
categories,
tags,
coverImage,
draft
出力する Front Matter
値:
author,
categories,
coverImage,
date,
draft,
excerpt,
id,
slug,
tags,
title,
type
--request-delay 500 画像ファイルのリクエスト間隔
--write-delay 10 書き込み間隔
--timezone utc 投稿日時のタイムゾーン
--include-time false Front Matter の date で時刻を含む
値: true, false
--date-format "" Front Matter の date の書式指定文字列
空文字列は yyyy-LL-dd 扱い
書式指定は Luxon を参照
--quote-date false Front Matter の date を二重引用符で囲む
値: true, false
--strict-ssl true SSL 証明書の検証を行う
値: true, false

※ Luxon の書式指定文字列 yyyy-LL-dd は基本的には yyyy-MM-dd と同じ意味ですが、ロシア語等の一部の言語で表記が変わるため区別されています。
※開発環境やプライベートネットワークで自己署名証明書を用いている等、明確な理由がある場合にのみオプション --strict-ssl=false を使用してください。

参考「Advanced Options - GitHub - lonekorean/wordpress-export-to-markdown: Converts a WordPress export XML file into Markdown files.
参考「Table of tokens - Parsing」(Luxon)
参考「Standalone vs format tokens - Formatting」(Luxon)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?