grunt-wp2md

0.1.7 • Public • Published

grunt-wp2md

Build Status

Convert WordPress XML to static Markdown files.

Getting Started

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');

The "wp2md" task

Overview

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.
    },
  },
})

Options

format

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

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

posts

Type: String
Default value: '_posts'

Posts destination folder

drafts

Type: String
Default value: '_drafts'

Drafts destination folder

pages

Type: String
Default value: ''

Pages destination folder

Usage Examples

WordPress XML

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

wpxml

Default

To simplify might do something like:

grunt.initConfig({
  wp2md: {
    default_options: {
      files: {
        'path/to/': ['/path/to/wordpress.xml'],
      },
    },
  }
});

Custom

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

Output

wp2md-output

Author

Hariadi Hinta

Release history

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

License

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

Package Sidebar

Install

npm i grunt-wp2md

Weekly Downloads

8

Version

0.1.7

License

none

Last publish

Collaborators

  • hariadi