class EditorJs::Blocks::MarkdownBlock
markdown block
Public Instance Methods
plain()
click to toggle source
# File lib/editor_js/blocks/markdown_block.rb, line 45 def plain data['text'].strip end
render(_options = {})
click to toggle source
rouge: syntax highlighter github.com/rouge-ruby/rouge/ spsarolkar.github.io/rouge-theme-preview/ shell: rougify help style # Get some CSS Rouge::Themes::Base16.mode(:light).render(scope: '.highlight') # Or use Theme#find with string input Rouge::Theme.find('base16.light').render(scope: '.highlight')
# File lib/editor_js/blocks/markdown_block.rb, line 32 def render(_options = {}) content_tag :div, class: css_name do content_text = data['text'] || '' CommonMarker::Rouge.render_html( content_text, %i[UNSAFE FOOTNOTES STRIKETHROUGH_DOUBLE_TILDE], %i[UNSAFE GITHUB_PRE_LANG HARDBREAKS TABLE_PREFER_STYLE_ATTRIBUTES FULL_INFO_STRING FOOTNOTES], %i[table strikethrough tasklist tagfilter], formatter: Rouge::Formatters::HTMLLegacy.new(inline_theme: 'github') ).html_safe end end
sanitize!()
click to toggle source
# File lib/editor_js/blocks/markdown_block.rb, line 7 def sanitize!; end
schema()
click to toggle source
# File lib/editor_js/blocks/markdown_block.rb, line 9 def schema YAML.safe_load(<<~YAML) type: object additionalProperties: false properties: text: type: string YAML end