Sha256: e168f041357b32dca2b45078b6bbd76f18a520cfa1e118a6491aa3cd918fe73c
Contents?: true
Size: 1.13 KB
Versions: 8
Compression:
Stored size: 1.13 KB
Contents
module Greenmat module Render # Markdown-stripping renderer. Turns Markdown into plaintext # Thanks to @toupeira (Markus Koller) class StripDown < Base # Methods where the first argument is the text content [ # block-level calls :block_code, :block_quote, :block_html, :list, :list_item, # span-level calls :autolink, :codespan, :double_emphasis, :emphasis, :underline, :raw_html, :triple_emphasis, :strikethrough, :superscript, # footnotes :footnotes, :footnote_def, :footnote_ref, # low level rendering :entity, :normal_text ].each do |method| define_method method do |*args| args.first end end # Other methods where we don't return only a specific argument def link(link, title, content) "#{content} (#{link})" end def image(link, title, content) content &&= content + " " "#{content}#{link}" end def paragraph(text) text + "\n" end def header(text, header_level) text + "\n" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems