Wordpress Import Markdown

Posted on  by admin

This post was updated on 22nd Jan 2020 with additional details from the developer of the conversion script.

  1. Wordpress Export Markdown
  2. Markdown Import File
  3. Wordpress Import Markdown Pages

This screen lists a number of useful tools for successfully importing from HTML to WordPress. Start Importing. Once you are done, save the settings. This will enable the Import Files button. Click it to get started. (Note: you can also get here via Tools Import and then picking Run Importer under the HTML option.) Next, choose whether to. Replaces the default WordPress editor with a Markdown editor for your posts and pages. SEO Themes 800+ active installations Tested with 4.9.17 Updated 3 years ago Import Markdown.

Markdown is a simplified version of HTML that is widely used by a number of content management systems around the Internet. If you want to know how to convert WordPress to Markdown, this post may help.


The new WordPress editor, Gutenberg, supports Markdown out of the box. But if you export your WordPress site, the output is an XML file. This XML file is no good for importing into content management systems that support Markdown.

If you’re a regular reader of this blog, you will know that I have migrated this site a number of times. So I thought I would explain the process I use to convert WordPress to Markdown.


Step 1: Export

The first thing you need to do is export your WordPress content to the standard XML format. To do this, log in to your WordPress admin console then go to Tools > Export. Select “All Content”, then hit thedownload button.

You will now have an exported XML file named something like [website].WordPress.[date].xml. Rename this file to export.xml.

Step 2: Install Node.js & NPM

Wordpress Export Markdown

For the conversation from XML to Markdown, we will use a script that is written in Node.js. For that to work we will need to install Node.js and NPM. I’m using an Ubuntu based system, so I can apt install the packages:

If you’re using a system that is not Ubuntu based, this page should help with installing Node.js.

Step 3: Git Clone

The script used to convert WordPress to Markdown is called wordpress-export-to-markdown. We will need to clone this Github repository in order to use it.

First move into your Downloads directory (or wherever you want to run the script from). Then clone the repository:

You should now have a folder called wordpress-export-to-markdown in your Downloads folder.

Markdown Import File


Move the export.xml file that you created earlier into the wordpress-export-to-markdown folder.

Step 4: Convert WordPress to Markdown

We now have everything we need to convert our WordPress XML to Markdown. Back in the terminal; move into the wordpress-export-to-markdown folder and run the script:

The script will now traverse the XML file and convert all your content to standard Markdown. It will also pull down any images from your live site as it goes.

Wordpress Import Markdown

Wordpress Import Markdown Pages

Once the process has completed, you will see an output folder. Within this folder are sub-folders for every one of your posts that contain a file called index.md. This is your post. There will also be another sub-folder containing any images for that post.

You can now use this Markdown to import into any content management system that supports Markdown. Like Hugo, Jekyll or Grav.


Unfortunately this process won’t export your pages to markdown – it just covers your posts. However, many websites don’t have a lot of pages, so a simple copy and paste of the pages’ content to your new CMS shouldn’t be too taxing.

Alternatively, you could fork the Github project and add support for converting pages too. That’s the beauty of open source software. 🙂


Even if you’re not intending to migrate your WordPress site to a Markdown based CMS, it’s still a good idea to have a backup of your WordPress site in an open standard, like Markdown.

All of the posts and images for this site, once exported to Markdown, equate to 15MB when compressed on my hard drive. So keeping a copy of your site in Markdown format certainly won’t fill your drive and it may get you out of a jam if you lose data.

This shouldn’t be your only WordPress site backup though. Remember to always secure your WordPress site.

Do you have a better way of converting WordPress to Markdown? If so, get in touch using the buttons below and I’ll be happy to post an update.

When I created the pages for my existing projects on this blog, I decided that I’d prefer to directly display the content of the readme files from Bitbucket (where all of my projects are hosted), instead of just copying the content.

So the readme would be under source control as well, and the project pages on this site would update automatically each time I push changes to the repository.

This blog is running on WordPress and the readme files are written in Markdown, but I couldn’t find a plugin to display a Markdown file from an external URL in WordPress.

What I did find was this answer on the WordPress site on Stack Exchange, where the answerer suggested to “parse the markdown file and show the contents in the page with some method, say with shortcode”.

That’s exactly what I wanted, so I just had to figure out how to make WordPress do this.
Here’s a complete walkthrough:

  1. Install PHP Markdown as a plugin in WordPress(see the link for instructions)
  2. Install the Shortcode Exec PHP plugin for WordPress
  3. In the WordPress admin panel, go to the Shortcode Exec PHP setup page (it’s in the Tools menu)
  4. Create a new shortcode, give it any name you want and paste the following PHP code:

Paste it exactly like shown here, don’t use <?php tags etc.

The include_once in the first line includes the PHP Markdown plugin installed in step 1.
This is the path where it’s located on MY server - don’t know if the path is the same in all WordPress installations.

Now, I can display my Bitbucket readme files, or other Markdown files from another server, by using the following shortcode on any WordPress page:
(where readme-md is the name given to the shortcode in step 4)

That’s it!
You can see it in action in any of the “projects” links on this site, for example here (with exactly the readme file from the above example).

Wordpress markdown editor

I’m completely new to WordPress, and the last time I used PHP must have been around 2004.
So maybe my way is not the most elegant way to do this - but at least this worked for me using the following versions:

  • WordPress 3.3.1
  • PHP Markdown 1.0.1o
  • Shortcode Exec PHP 1.41