Created
April 13, 2018 21:18
-
-
Save nisevi/d2441c7589fc945660a1a9ef8f61aad6 to your computer and use it in GitHub Desktop.
This service acts as a wrapper that encapsulates the 'kramdown' functionality.
This file contains 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
class MarkdownConverter | |
attr_reader :markdown | |
private :markdown | |
def initialize(markdown) | |
@markdown = markdown | |
end | |
def as_html | |
converted_markdown.html_safe | |
end | |
private | |
def converted_markdown | |
Kramdown::Document.new(markdown).to_html | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment