Class: GithubToCanvasQuiz::MarkdownConverter
- Inherits:
-
Object
- Object
- GithubToCanvasQuiz::MarkdownConverter
- Defined in:
- lib/github_to_canvas_quiz/markdown_converter.rb
Overview
Constant Summary collapse
- OPTIONS =
{ tables: true, autolink: true, fenced_code_blocks: true, disable_indented_code_blocks: true, no_intra_emphasis: true }.freeze
Instance Attribute Summary collapse
-
#markdown ⇒ Object
readonly
Returns the value of attribute markdown.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(markdown, options = {}) ⇒ MarkdownConverter
constructor
A new instance of MarkdownConverter.
-
#to_html ⇒ String
The markdown converted to HTML.
Constructor Details
#initialize(markdown, options = {}) ⇒ MarkdownConverter
Returns a new instance of MarkdownConverter.
28 29 30 31 |
# File 'lib/github_to_canvas_quiz/markdown_converter.rb', line 28 def initialize(markdown, = {}) @options = OPTIONS.merge() @markdown = markdown end |
Instance Attribute Details
#markdown ⇒ Object (readonly)
Returns the value of attribute markdown.
16 17 18 |
# File 'lib/github_to_canvas_quiz/markdown_converter.rb', line 16 def markdown @markdown end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/github_to_canvas_quiz/markdown_converter.rb', line 16 def @options end |
Instance Method Details
#to_html ⇒ String
Returns the markdown converted to HTML.
34 35 36 |
# File 'lib/github_to_canvas_quiz/markdown_converter.rb', line 34 def to_html Redcarpet::Markdown.new(renderer, ).render(markdown) end |