grunt-wp2md

Convert WordPress XML to static Markdown files.

grunt-wp2md

Convert WordPress XML to static Markdown files.

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-wp2md --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-wp2md');

In your project's Gruntfile, add a section named wp2md to the data object passed into grunt.initConfig().

grunt.initConfig({
  wp2md: {
    options: {
      // Task-specific options go here. 
    },
    your_target: {
      // Target-specific file lists and/or options go here. 
    },
  },
})

Type: String
Default value: 'yyyy-mm-dd'

Add date prefix name to markdown generated file. Example: 2013-11-27-filename.md

Type: String
Default value: '_posts'

Posts destination folder

Type: String
Default value: '_drafts'

Drafts destination folder

Type: String
Default value: ''

Pages destination folder

Export your content in "Tools" → "Export" → "WordPress" in your WordPress dashboard and put XML file to /path/to/wordpress.xml

To simplify might do something like:

grunt.initConfig({
  wp2md: {
    default_options: {
      files: {
        'path/to/': ['/path/to/wordpress.xml'],
      },
    },
  }
});
grunt.initConfig({
  wp2md: {
    custom_options: {
      options: {
        format: '',
        posts: 'src/_posts',
        drafts: 'src/_drafts',
        pages: 'src/pages'
      },
      files: {
        'tmp/custom_options/': ['test/fixtures/*.xml'],
      },
    },
  }
});

Hariadi Hinta

DATE VERSION CHANGES

  • 2013-11-25 v0.1.3 Use external library for async and lodash for great performance.,Upgrade Grunt 0.4.2
  • 2013-07-29 v0.1.2 Add destination options to posts, drafts and pages.
  • 2013-07-28 v0.1.1 Documentation tweaks.,Add Travis.
  • 2013-10-27 v0.1.0 Initial

Copyright (c) 2014 Hariadi Hinta, contributors.
Released under the MIT license