Module: Markdpwn::Dpwn
- Defined in:
- lib/markdpwn/dpwn.rb
Overview
markdpwn is a clone of gfm (Git-Flavored Markdown).
Class Method Summary collapse
-
.accepts?(options) ⇒ Boolean
Checks if some file should be formatted using Markdpwn.
-
.render(text, options = {}) ⇒ String
Marks up text using markdpwn.
Class Method Details
.accepts?(options) ⇒ Boolean
Checks if some file should be formatted using Markdpwn.
36 37 38 39 40 |
# File 'lib/markdpwn/dpwn.rb', line 36 def self.accepts?() return unless file_name = [:file_name] ext = File.extname file_name ['.markdown', '.md'].include? ext end |
.render(text, options = {}) ⇒ String
Marks up text using markdpwn.
The caller is responsible for making sure that the text can be rendered using markdpwn.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/markdpwn/dpwn.rb', line 15 def self.render(text, = {}) renderer = Markdpwn::RedCarpetRenderer.new md = Redcarpet::Markdown.new renderer, autolink: true, no_intra_emphasis: true, tables: true, fenced_code_blocks: true, strikethrough: true, space_after_headers: true md.render text end |