Skip to content

Instantly share code, notes, and snippets.

@zeke
Last active December 17, 2015 12:59
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeke/5613893 to your computer and use it in GitHub Desktop.
Save zeke/5613893 to your computer and use it in GitHub Desktop.
A brutish migration script from Tumblr posts to Jekyll-friendly markdown files.
# Change this to your blog URL...
export TUMBLR_URL="http://zeke.tumblr.com"
# As of this writing, jekyll and jekyll-import are busted. :(
gem uninstall jekyll -aIx
# Install an old version of jekyll that includes a migration script
gem install jekyll -v 0.11.2
# Install a python package that converts HTML to Markdown
sudo pip install html2text
# Get them posts (various sources suggest that a "markdown" argument can be passed
# to the process function, but it didn't work for me)
ruby -rubygems -e 'require "jekyll/migrators/tumblr"; Jekyll::Tumblr.process(ENV["TUMBLR_URL"])'
# Convert HTML files to Markdown
for file in _posts/tumblr/*.html; do html2text "$file" > "${file/.html/.md}"; rm "$file"; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment