Skip to content

Instantly share code, notes, and snippets.

@serihiro
Last active April 19, 2018 05:23
Show Gist options
  • Select an option

  • Save serihiro/d4c8ec45fb2ec7996f9c2c7f50df679b to your computer and use it in GitHub Desktop.

Select an option

Save serihiro/d4c8ec45fb2ec7996f9c2c7f50df679b to your computer and use it in GitHub Desktop.
markdown2pukiwiki
if ARGV.empty?
puts 'Usage: ruby md2pukiwiki.rb input.md'
exit 1;
end
input = File.open(File.expand_path(ARGV[0], File.join(__FILE__, '../'))).read rescue ''
output = input.gsub(/\[(?<text>.+)\]\((?<url>.+)\)/,'[[\k<text>>\k<url>]]').gsub('#', '*').gsub(' ', '-')
puts output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment