Class: ApplicationMarkdown

Inherits:
MarkdownRails::Renderer::Rails show all
Includes:
Redcarpet::Render::SmartyPants
Defined in:
lib/generators/markdown_rails/install/templates/app/markdown/application_markdown.rb

Overview

You should read the docs at github.com/vmg/redcarpet and probably delete a bunch of stuff below if you don’t need it.

Direct Known Subclasses

ErbMarkdown

Instance Method Summary collapse

Methods inherited from MarkdownRails::Renderer::Base

#renderer

Instance Method Details

#enableObject

These flags control features in the Redcarpet renderer, which you can read about at github.com/vmg/redcarpet#and-its-like-really-simple-to-use Make sure you know what you’re doing if you’re using this to render user inputs.



27
28
29
# File 'lib/generators/markdown_rails/install/templates/app/markdown/application_markdown.rb', line 27

def enable
  [:fenced_code_blocks]
end

#image(link, title, alt) ⇒ Object

Example of how you might override the images to show embeds, like a YouTube video.



32
33
34
35
36
37
38
39
40
# File 'lib/generators/markdown_rails/install/templates/app/markdown/application_markdown.rb', line 32

def image(link, title, alt)
  url = URI(link)
  case url.host
  when "www.youtube.com"
    youtube_tag url, alt
  else
    super
  end
end