Created
July 29, 2018 23:30
-
-
Save jonniesweb/00a0c3a837574c1d121224234fd15c83 to your computer and use it in GitHub Desktop.
Render markdown into HTML using the Redcarpet library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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