Skip to content

Instantly share code, notes, and snippets.

@vors
Last active August 29, 2015 14:10
Show Gist options
  • Save vors/3bac89541222d77361d9 to your computer and use it in GitHub Desktop.
Save vors/3bac89541222d77361d9 to your computer and use it in GitHub Desktop.
Converts markdown to plain text with https://github.com/vmg/redcarpet
#!/usr/bin/env ruby
require 'redcarpet'
require 'redcarpet/render_strip'
# require 'redcarpet/render_man.rb'
# Get stdin as a string
input = STDIN.readlines.join("\n")
# Initializes a Markdown parser
markdown = Redcarpet::Markdown.new(Redcarpet::Render::ManPage)
# Render
output = markdown.render(input)
# Print output to stdout
puts output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment