Sha256: 4634ccbf350b9f5652b022ea1ae5cefce1f6f5ddd2589b966e556bf12adaa8cd
Contents?: true
Size: 555 Bytes
Versions: 6
Compression:
Stored size: 555 Bytes
Contents
module Filters module PreFilter def format_helper!(text) text.gsub! /\n?``` helper(.+?)```/m do |block| block.gsub! /^``` helper\s*/, '' block.gsub! /^```$/, '' header = '' block.gsub! /^#### (.+?)$/ do header = $1.strip '' end content = block.strip content = "<p>#{content}</p>" unless content =~ /^<p/ content = "<div class='helper'><h4 class='header'><a href='#'>#{header}</a></h4><div class='content'>#{content}</div></div>" end end end end
Version data entries
6 entries across 6 versions & 1 rubygems