Last active
December 17, 2015 12:59
-
-
Save zeke/5613893 to your computer and use it in GitHub Desktop.
A brutish migration script from Tumblr posts to Jekyll-friendly markdown files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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