pot_markdown

Markdown processor for Potmum

0
0
Ruby

PotMarkdown

Build Status

PotMarkdown is markdown processor for Potmum.

Installation

Add this line to your application’s Gemfile:

gem 'pot_markdown'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pot_markdown

Usage

require 'pot_markdown'

processor = PotMarkdown::Processor.new
context = {
  safe_script_url: false
}
processor.call("# title\n\n Hello, **Potmum!** ...", context)
# => {
#  toc: "<ul><li><a href=\"#id-title\">title ...",
#  output: "<h1 id=\"id-title\">title</h1>...",
#  mentioned_usernames: ['rutan', ...]
# }

context

  • anchor_icon
    • header link icon
    • default)
      • <i class="fa fa-link"></i>
  • checkbox_enable
    • not set attribute disabled to checkbox
    • default: false
  • checkbox_class
    • <li> 's class with checkbox
    • default: task-list-item
  • sanitize_rule
  • sanitize_use_external
    • to enable the particular script/iframe
    • ex)
      • Youtube
      • Twitter
      • niconico
      • SlideShare
      • and more… (see SanitizeIframeFilter and SanitizeScriptFilter)
  • safe_iframe_url
    • enable iframe url, if use sanitize_use_external
  • safe_script_url
    • enable script url, if use sanitize_use_external

others

PotMarkdown used these filters.

  • HTML::Pipeline::AutolinkFilter
  • HTML::Pipeline::EmojiFilter
  • HTML::Pipeline::MentionFilter

please see html-pipeline documents 😃

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/rutan/pot_markdown