Method: CommonMarker.render_html
- Defined in:
- lib/commonmarker.rb
.render_html(text, options = :DEFAULT, extensions = []) ⇒ Object
Public: Parses a Markdown string into an HTML string.
text - A String of text option - Either a Symbol or of Symbols indicating the render options extensions - An of Symbols indicating the extensions to use
Returns a String of converted HTML.
22 23 24 25 26 27 28 29 |
# File 'lib/commonmarker.rb', line 22 def self.render_html(text, = :DEFAULT, extensions = []) raise TypeError, "text must be a String; got a #{text.class}!" unless text.is_a?(String) opts = Config.(, :render) text = text.encode('UTF-8') html = Node.markdown_to_html(text, opts, extensions) html.force_encoding('UTF-8') end |