Sha256: b8e8f5b9f0631f5d706b6bc1d187f2f7e7a394e8169ea5ebd19253bc73150cf3
Contents?: true
Size: 680 Bytes
Versions: 1
Compression:
Stored size: 680 Bytes
Contents
# frozen_string_literal: true # Tag for text content that is going to be rendered using textarea with markdown # {{ cms:markdown identifier }} # class Occams::Content::Tag::Markdown < Occams::Content::Tag::Fragment def render renderable ? Kramdown::Document.new(content.to_s).to_html : "" end def form_field(object_name, view, index) name = "#{object_name}[fragments_attributes][#{index}][content]" options = { id: form_field_id, data: { "cms-cm-mode" => "text/x-markdown" } } input = view.send(:text_area_tag, name, content, options) yield input end end Occams::Content::Renderer.register_tag( :markdown, Occams::Content::Tag::Markdown )
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
occams-1.0.1 | lib/occams/content/tags/markdown.rb |