Sha256: ad7ebee64287bb873f1e55039287d7ca1f76023011db780491504bff2caa3b06

Contents?: true

Size: 462 Bytes

Versions: 3

Compression:

Stored size: 462 Bytes

Contents

# frozen_string_literal: true

module Components
	class Markdown < Phlex::View
		class Render < Redcarpet::Render::HTML
			def header(text, level)
				case level
				when 1
					Title.new.call { text }
				else
					Heading.new.call { text }
				end
			end
		end

		MARKDOWN = Redcarpet::Markdown.new(Render.new, autolink: true, tables: true)

		def initialize(content)
			@content = content
		end

		def template
			raw MARKDOWN.render(@content)
		end
	end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phlex-0.3.2 docs/components/markdown.rb
phlex-0.3.1 docs/components/markdown.rb
phlex-0.3.0 docs/components/markdown.rb