1. David Corne
  2. Wordpress to Markdown

Overview

Wordpress To Markdown

This is a script to convert wordpress.com style html (including sourcecode) into github flavour markdown.

Continuous Integration

I have an account on [drone.io](https://drone.io/) for continuous integration. This runs the unit tests and uses [pylint](http://www.pylint.org/) to check for errors.

[![Build Status](https://drone.io/bitbucket.org/davidcorne/wordpress-to-markdown/status.png)](https://drone.io/bitbucket.org/davidcorne/wordpress-to-markdown/latest)

Script Usage

usage: Wordpress2Markdown [-h] [-f] wordpress_html

This script converts wordpress.com html into markdown syntax.

positional arguments:
wordpress_html
optional arguments:
-h, --help show this help message and exit
-f, --file Read the Wordpress.com html from a file

How it works

This passes over the text several times, converting a different construction on each pass.

Passes

  1. <h[1,2,3,4,5,6]> tags -> #, ##, ###, ####, #####, ###### pairs
  2. &lt;a href="url">title</a> -> [title](url)
  3. [sourcecode language="lang"] -> ```lang
  4. [/sourcecode] -> ```
  5. &lt;!-- --> comments deleted, mainly due to &lt;!--more--> tags.

Note converting [sourcecode] tags currently ignores any option but language.

Unimplemented features:

  • ordered/unordered lists
  • images