Sha256: eeae8246a2461e96101888cfe0f62a94d2a6259ebac6e27aeba59f0a15dc3e91
Contents?: true
Size: 747 Bytes
Versions: 1
Compression:
Stored size: 747 Bytes
Contents
# frozen_string_literal: true # Tag for text content that is going to be rendered using textarea with markdown # {{ cms:markdown identifier }} # class ComfortableMediaSurfer::Content::Tags::Markdown < ComfortableMediaSurfer::Content::Tags::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 ComfortableMediaSurfer::Content::Renderer.register_tag( :markdown, ComfortableMediaSurfer::Content::Tags::Markdown )
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
comfortable_media_surfer-3.0.0 | lib/comfortable_media_surfer/content/tags/markdown.rb |