Skip to content

Instantly share code, notes, and snippets.

@nisevi
Created April 13, 2018 21:18
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 nisevi/d2441c7589fc945660a1a9ef8f61aad6 to your computer and use it in GitHub Desktop.
Save nisevi/d2441c7589fc945660a1a9ef8f61aad6 to your computer and use it in GitHub Desktop.
This service acts as a wrapper that encapsulates the 'kramdown' functionality.
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