Unit Propagation - WordPress Export to Markdown (opens in new tab)

Friday, January 23, 2026

I’m working on consolidating my previous blogs into this blog. That is, giving the content of the old blogs an immutable corner on this new site for reference and enjoyment. And also, for curious people to see what I was up to in the 2010’s, and preserving that for the future. While my old WordPress blog is still live at the time of writing, there’s no guaranteeing how long that will be the case.

As part of this effort, I braincoded a quick script that turns WordPress data exports into folders of Markdown files. The WordPress export I had access two comes in two parts:

  • A chunky XML file containing all posts, pages, comments etc. of the site, called “wordpressContentExport”, or content export for short.
  • A dated folder hierarchy filled with media, mostly pictures in my case. This is called the “wordpressMediaExport”, or media export for short.

My script only considers the content export as input. The script generates the following folder hierarchy in the output folder:

./out/
├── index.md
├── page
│   ├── about-me
│   │   └── index.md
│   ├── february-operation-get-out
│   │   └── index.md
│   ...
└── post
├── doing-some-catch-up
│   └── index.md
├── first-level-done
│   └── index.md
...

The top-level index.md is a sort of table of contents for the whole directory. Then, for each type of top-level item in the wordpress export, the script creates a folder. These are the page, post, etc. folders. These top-level folders then contain subfolders for each item of that type in the content export, where the index.md files within those folders contain the actual page/post/etc. content and metadata.

Other folders the script generates are attachment and wp_global_styles. I didn’t integrate those properly with the page and post directories, nor with the media export. It’s possible, but would require more work. I basically stopped working on the script when I reached the point that integrating the Markdown export into my site proper was very little work, and hence further work on the script wasn’t worth it anymore. I can imagine if you have a “proper” blog, and not just a handful of posts like on my old blog, you’d prefer expanding the script to cover the media export as well, instead of doing it manually.

Loading more...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help