Sha256: 9d5e48f7422da7e1af31e4bc417f9d820b5733deca72a44a8ea0bdeb309047ea

Contents?: true

Size: 623 Bytes

Versions: 6

Compression:

Stored size: 623 Bytes

Contents

# frozen_string_literal: true

require 'commonmarker'

module Hanamimastery
  module CLI
    module Transformations
      class ToPRO
        # TODO: Make it Configurable
        HOST = "https://hanamimastery.com"

        # Transforms Markdown input to HTML output compatible with Podia.com editor
        #
        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
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hanamimastery-cli-0.4.0 lib/hanamimastery/cli/transformations/to_pro.rb
hanamimastery-cli-0.3.1 lib/hanamimastery/cli/transformations/to_pro.rb
hanamimastery-cli-0.3.0 lib/hanamimastery/cli/transformations/to_pro.rb
hanamimastery-cli-0.2.2 lib/hanamimastery/cli/transformations/to_pro.rb
hanamimastery-cli-0.2.1 lib/hanamimastery/cli/transformations/to_pro.rb
hanamimastery-cli-0.2.0 lib/hanamimastery/cli/transformations/to_pro.rb