Sha256: 620a89a2c4aa37e562f0102ed37b3a8d4bfd286dc9f1cb9ff5ebc768b71b9efe
Contents?: true
Size: 473 Bytes
Versions: 37
Compression:
Stored size: 473 Bytes
Contents
# encoding: utf-8 class MarkdownString # Return markdown codes from text # # === Example # # MarkdownString.codes("class Hoge\n def hoge\n 'hoge'\n end\nend\n") # # result # # ~~~ruby # class Hoge # def hoge # 'hoge' # end # end # ~~~ # def self.codes(text, lang = nil) lang = '' if lang.nil? text = '' if text.nil? return text unless text.is_a?(String) "~~~#{lang}\n#{text}\n~~~\n" end end
Version data entries
37 entries across 37 versions & 1 rubygems