class MemoRack::PageInfoMarkdown

Public Class Methods

extnames() click to toggle source

ファイル拡張子

# File lib/memorack/plugins/formats/markdown.rb, line 9
def self.extnames
        ['md', 'mkd', 'markdown']
end

Public Instance Methods

accept_title(line, prev = nil) click to toggle source
# File lib/memorack/plugins/formats/markdown.rb, line 13
def accept_title(line, prev = nil)
        case line
        when /^(\#{1,6}?)\s+(.+)$/
                level = $1.length
                headline = $2.gsub(/\#+\s*$/, '').strip
                return headline
        when /^\s*([=\-])+\s*$/
                return nil unless prev

                prev = prev.strip
                unless prev.empty?
                        level = ($1 == '=') ? 1 : 2
                        return prev
                end
        end
end