Class: Hanamimastery::CLI::Transformations::ToPRO

Inherits:
Object
  • Object
show all
Defined in:
lib/hanamimastery/cli/transformations/to_pro.rb

Constant Summary collapse

HOST =

TODO: Make it Configurable

"https://hanamimastery.com"

Instance Method Summary collapse

Instance Method Details

#call(content) ⇒ Object

Transforms Markdown input to HTML output compatible with Podia.com editor



14
15
16
17
18
19
20
21
# File 'lib/hanamimastery/cli/transformations/to_pro.rb', line 14

def call(content)
  result = content.gsub(/:::(.*?):::/m, '')
  result = Commonmarker.to_html(result)
  result
    .gsub('src="/images', %{src="#{HOST}/images})
    .gsub(/<h\d>/, "<h1>")
    .gsub(/<\/h\d>/, "</h1>")
end