Sha256: 48b034eef2c367aa407d67f6eaab7fa1af19e6583699e30e6514ff9a7dbdb414
Contents?: true
Size: 747 Bytes
Versions: 66
Compression:
Stored size: 747 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
66 entries across 66 versions & 1 rubygems