class Kmarkdown

Markdonw is a wrapper over Kramdown::Document that

Take care of two things about config - it must:

Usage:

md = Markdown.new(File.read("document.md"))
File.write("document.html", md.toc << "\n" << md.html)

Constants

DEFAULT_OPTIONS

Public Class Methods

new(text, options = {}) click to toggle source
Calls superclass method
# File lib/minireq/site/kmarkdown.rb, line 25
def initialize(text, options = {})
  to_kramdown!(text)
  options.merge! DEFAULT_OPTIONS
  super(text, options)
end

Public Instance Methods

html() click to toggle source
# File lib/minireq/site/kmarkdown.rb, line 31
def html
  to_html
end
toc() click to toggle source
# File lib/minireq/site/kmarkdown.rb, line 35
def toc
  build_toc(to_toc)
end

Protected Instance Methods

build_toc(toc, html = nil) click to toggle source

syntax_highlighter: :rouge, syntax_highlighter_opts: { line_numbers: false }

# File lib/minireq/site/kmarkdown.rb, line 48
def build_toc(toc, html = nil)
  html ||= ""
  html << "<ul>\n"
  toc.children.inject(html) do |s, h|
    s << "<li>" << build_link(h)
    build_toc(h, s) unless h.children.empty?
    s << "</li>\n"
  end
  html << "</ul>\n"
end