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

Version Path
tbpgr_utils-0.0.151 lib/markdown/codes.rb
tbpgr_utils-0.0.150 lib/markdown/codes.rb
tbpgr_utils-0.0.149 lib/markdown/codes.rb
tbpgr_utils-0.0.148 lib/markdown/codes.rb
tbpgr_utils-0.0.147 lib/markdown/codes.rb
tbpgr_utils-0.0.146 lib/markdown/codes.rb
tbpgr_utils-0.0.145 lib/markdown/codes.rb
tbpgr_utils-0.0.144 lib/markdown/codes.rb
tbpgr_utils-0.0.143 lib/markdown/codes.rb
tbpgr_utils-0.0.142 lib/markdown/codes.rb
tbpgr_utils-0.0.141 lib/markdown/codes.rb
tbpgr_utils-0.0.140 lib/markdown/codes.rb
tbpgr_utils-0.0.139 lib/markdown/codes.rb
tbpgr_utils-0.0.138 lib/markdown/codes.rb
tbpgr_utils-0.0.137 lib/markdown/codes.rb
tbpgr_utils-0.0.136 lib/markdown/codes.rb
tbpgr_utils-0.0.135 lib/markdown/codes.rb
tbpgr_utils-0.0.134 lib/markdown/codes.rb
tbpgr_utils-0.0.133 lib/markdown/codes.rb
tbpgr_utils-0.0.132 lib/markdown/codes.rb