Skip to content

Instantly share code, notes, and snippets.

@tylerball
Created September 12, 2014 14:18
Show Gist options
  • Save tylerball/0a443dd30826f20700a3 to your computer and use it in GitHub Desktop.
Save tylerball/0a443dd30826f20700a3 to your computer and use it in GitHub Desktop.
I had a bunch of jekyll posts written in textile with yaml frontmatter I needed to convert to markdown
require 'preamble'
require 'pandoc-ruby'
Dir.glob('*.textile').each do |file|
front = Preamble.load(file)
converter = PandocRuby.new(front.content, from: :textile, to: :markdown)
markdown = converter.convert
new_file = Preamble.new(front.metadata, markdown)
new_file.save(file.sub('textile', 'markdown'))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment