Skip to content
Static blog tool for
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
blog-pages
blog-posts
blog-static
dist
doc/metrics/custardbelly.com
images
.gitignore
.htaccess
.jshintrc
LICENSE-MIT
README.md
blog-to-markdown.py
gulpfile.js
package.json
post-parser.js
requirements.txt
wpstatic
yslow.js

README.md

Introduction

Example of how to convert articles of a WordPress blog to static markdown.

Requirements

wpstatic

wpstatic is used to read in all content of a WordPress blog and generate an HTML file of all articles held in the WP database.

Steps

  1. Download/Clone wpstatic
  2. Upload to server hosting WP blog within the same directory that contains wp-config.php
  3. Run: '$ ./wpstatic'

Notes

  • I went into WP admin console and changed the post count on page to 1000, allowing for all posts to be accessed in a single request from wpstatic
  • I had to change line 121 in wpstatic to work on the system that hosted my WP blog. I changed:
    if [[ "$tablename" =~ $tb_prefix ]]; then to if [[ "$tablename" = ~$tb_prefix ]]; th

PhantomJS

PhantomJS is used to read in the full output HTML file from wpstatic and split out single articles.

virtualenvwrapper

Assume using virutalenvwrapper for python projects.

NodeJS, NPM & Grunt

Uses grunt-markdown-blog to generate HTML articles based on converted markdown.

Articles to Markdown

| using html2text.

  1. Setup virtualenv and install requirements.
$ mkvirtualenv blog -r requirements.txt --system-site-packages
  1. Start local server
$ python -m SimpleHTTPServer 8080
  1. Load output of wpstatic into phantomjs and output to singular files organized by title/date
$ phantomjs post-parser.js
  1. Convert single posts to markdown using html2text
$ python blog-to-markdown.py

Markdown to Articles

| using grunt-markdown-blog task.

Notes grunt-markdown-blog uses Underscore templates.

You can’t perform that action at this time.