Module: DevcenterParser

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

Defined Under Namespace

Classes: InvalidMarkdownError, InvalidRawHTMLError

Constant Summary collapse

VERSION =
'2.1.1'

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) ⇒ Object



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

def self.to_html(markdown)
  sanitize to_unsanitized_html(markdown)
end

.to_unsanitized_html(markdown) ⇒ Object



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

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