Module: DevcenterParser

Defined in:
lib/devcenter-parser.rb,
lib/devcenter-parser/version.rb

Defined Under Namespace

Classes: InvalidMarkdownError, InvalidRawHTMLError

Constant Summary collapse

VERSION =
'2.3.0'.freeze

Class Method Summary collapse

Class Method Details

.sanitize(html) ⇒ Object



25
26
27
# File 'lib/devcenter-parser.rb', line 25

def self.sanitize(html)
  Sanitize.clean(html, sanitize_config)
end

.to_html(markdown, options = {}) ⇒ Object



13
14
15
# File 'lib/devcenter-parser.rb', line 13

def self.to_html(markdown, options = {})
  sanitize to_unsanitized_html(markdown, options)
end

.to_unsanitized_html(markdown, options = {}) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/devcenter-parser.rb', line 17

def self.to_unsanitized_html(markdown, options = {})
  markdown = normalize_markdown(markdown)
  doc = GitHubParser.parse(markdown)
  doc_to_html(doc, options)
rescue InvalidRawHTMLError => e
  raise InvalidMarkdownError, e.message
end