Class: Decidim::EnhancedTextwork::HtmlToMarkdown

Inherits:
Object
  • Object
show all
Defined in:
lib/decidim/enhanced_textwork/html_to_markdown.rb

Overview

This class parses a participatory text document from quill editor in markdown

This implementation uses Kramdown Base renderer.

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ HtmlToMarkdown

Public: Initializes the serializer with a paragraph.



13
14
15
# File 'lib/decidim/enhanced_textwork/html_to_markdown.rb', line 13

def initialize(html)
  @html = html
end

Instance Method Details

#to_mdObject



17
18
19
# File 'lib/decidim/enhanced_textwork/html_to_markdown.rb', line 17

def to_md
  ::Kramdown::Document.new(@html, input: "html").to_kramdown
end