Skip to content

Instantly share code, notes, and snippets.

@jonniesweb
Created July 29, 2018 23:30
Show Gist options
  • Save jonniesweb/00a0c3a837574c1d121224234fd15c83 to your computer and use it in GitHub Desktop.
Save jonniesweb/00a0c3a837574c1d121224234fd15c83 to your computer and use it in GitHub Desktop.
Render markdown into HTML using the Redcarpet library
require 'redcarpet'
text = '*markdown!*'
# Initialize a Markdown parser
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
# render the text to HTML
markdown.render(text) # returns "<p><em>markdown!</em></p>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment