Sha256: a7c2ac703c02549883830e7a28d5c05bbcef65e5e5a06553d481514a1c2958d3

Contents?: true

Size: 299 Bytes

Versions: 1

Compression:

Stored size: 299 Bytes

Contents

# -*- coding: utf-8 -*-
=begin rdoc
Headline
=end

class Headline < OpenStruct

  def to_markdown
    indent + "* " + link + "\n"
  end

  def indent
    level ? ("  " * (level - 2)) : ""
  end

  def link
    "[#{text}](##{anchor})"
  end

  def anchor
    text.downcase.gsub(/\W+/,'-')
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sixarm_ruby_markdown_table_of_contents-2.1.0 lib/sixarm_ruby_markdown_table_of_contents/markdown/headline.rb