Skip to content

Instantly share code, notes, and snippets.

@satooshi
Created February 24, 2013 09:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satooshi/5023226 to your computer and use it in GitHub Desktop.
Save satooshi/5023226 to your computer and use it in GitHub Desktop.
Convert tumblr blog html to markdown (pandoc required). See gist 5023141.
#!/bin/sh
cmd_pandoc="pandoc -f html -t markdown body.html -o body.md"
posts=`ls _posts`
root_dir=`pwd`
for post in ${posts}
do
post_dir="_posts/${post}"
echo ${post_dir}
# html 2 markdown
cd ${post_dir}
${cmd_pandoc}
rm body.html
markdown=`ls *.markdown`
for md in ${markdown}
do
echo "" >> ${md}
cat body.md >> ${md}
rm body.md
done
# done post
cd ${root_dir}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment