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.131 lib/markdown/codes.rb
tbpgr_utils-0.0.130 lib/markdown/codes.rb
tbpgr_utils-0.0.129 lib/markdown/codes.rb
tbpgr_utils-0.0.128 lib/markdown/codes.rb
tbpgr_utils-0.0.127 lib/markdown/codes.rb
tbpgr_utils-0.0.126 lib/markdown/codes.rb
tbpgr_utils-0.0.125 lib/markdown/codes.rb
tbpgr_utils-0.0.124 lib/markdown/codes.rb
tbpgr_utils-0.0.123 lib/markdown/codes.rb
tbpgr_utils-0.0.122 lib/markdown/codes.rb
tbpgr_utils-0.0.121 lib/markdown/codes.rb
tbpgr_utils-0.0.120 lib/markdown/codes.rb
tbpgr_utils-0.0.119 lib/markdown/codes.rb
tbpgr_utils-0.0.118 lib/markdown/codes.rb
tbpgr_utils-0.0.117 lib/markdown/codes.rb
tbpgr_utils-0.0.116 lib/markdown/codes.rb
tbpgr_utils-0.0.115 lib/markdown/codes.rb