Skip to content

Instantly share code, notes, and snippets.

@gjtorikian
Created November 20, 2015 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gjtorikian/25e7db08ed895d728bb8 to your computer and use it in GitHub Desktop.
Save gjtorikian/25e7db08ed895d728bb8 to your computer and use it in GitHub Desktop.
indent to backticks
Dir.glob('content/**/*.md') do |file|
content = File.read(file)
content = content.gsub(/{:.terminal}\n[\s\S]*?^$/) do |match|
lines = match.lines
lines = lines[1..-1].map do |line|
line[4..-1]
end
lines.unshift("``` command-line\n")
lines << "```\n"
lines.join
end
File.write(file, content)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment