Sha256: c3daef567f94c9bc8f6e19747470e82d5ce23d5bfc312ff1b98a1f791d8b6e0a
Contents?: true
Size: 761 Bytes
Versions: 1
Compression:
Stored size: 761 Bytes
Contents
# frozen_string_literal: true require "redcarpet" module Plutonium module UI module Display module Component class MarkdownField < Phlexi::Display::Components::Base include Phlexi::Display::Components::Concerns::DisplaysValue RENDERER = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true) def render_value(value) article(**attributes) do unsafe_raw RENDERER.render(value) end end private def normalize_value(value) if value.respond_to?(:to_plain_text) value.to_plain_text else value.to_s end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
plutonium-0.15.23 | lib/plutonium/ui/display/component/markdown_field.rb |