Sha256: febca5644c22c656aff4430b5b1900502101bd331fc04e005b80b0de345793f6
Contents?: true
Size: 778 Bytes
Versions: 35
Compression:
Stored size: 778 Bytes
Contents
# encoding: utf-8 require 'active_support/core_ext/object/inclusion' require 'open_classes/string/heading_helper' class String include HeadingHelper # Markdown MARKDOWN = '#' # Separator SEPARATOR = ' ' # create heading string with Emmet-like syntax. # # ==== Examples # # > case # # 'hoge>hige'.to_markdown_heading # => '# hoge\n## hige' # # + case # # 'hoge+hige'.to_markdown_heading # => '# hoge\n# hige' # # ^ case # # 'hoge>hige^hege'.to_markdown_heading # => '# hoge\n## hige\n# hege' # def to_markdown_heading heading = to_heading to_markdown heading end private def to_markdown(heading) to_head(heading, MARKDOWN, separator: SEPARATOR, start_level: 1) end end
Version data entries
35 entries across 35 versions & 1 rubygems