Git Product home page Git Product logo

wp2md's Introduction

wp2md

Wordpress XML Export to Markdown Text File Converter for Python 3.x

This python 3.x script will convert a Wordpress export file into a collection of markdown formatted text files.

Usage:

python wp2md.py <export file> <output folder>

e.g.

python wp2md.py c:\temp\blog_export.xml c:\temp\output

Pre-Requisites

The script makes use of both the markdownify, and unidecode modules, which should be installed with PIP as per the commands below:

pip install markdownify

pip install unidecode

Output

The script creates a folder structure within the output folder of years, and months (in yyyy-mm format). Each markdown file within those folders will be named by it's original post date (in yyyy-mm-dd format) along the post title - e.g. 2019-07-08 Hello World.md.

Within each markdown file, the original post title is on the first line, the date in long format (e.g. Monday 8th July 2019) is on the third line, and content begins on the 5th line.

Most common extended characters are replaced at run-time to their ascii equivalents - so curly quotes, long dashes, etc are replaced with standard ascii equivalents.

Notes

I have not experimented with images and media within the blog export, and I have not played with removing all the Wordpress block comments - mostly because I did not need to for my own blog. If this is an issue for you, you might want to extend the code further and/or re-write the way the script deals with that content.

Feel free to visit my blog backup at https://github.com/jonbeckett/blog to see what the output looks like.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.