Sha256: 8de8ae8a14f2099a006cd4a42bac9a0846391cc689322af43c1414aaaa56e7d4
Contents?: true
Size: 590 Bytes
Versions: 10
Compression:
Stored size: 590 Bytes
Contents
module Filters module PreFilter def format_helper(text) prefix = '<p' text.gsub /\n?``` helper(.+?)```/m do |block| block.gsub! /^``` helper/, '' block.gsub! /^```$/, '' header = '' block.gsub! /^#### (.+?)$/ do header = $1.strip '' end content = block.strip content = "<p>#{content}</p>" unless content[0, prefix.length] == prefix 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
10 entries across 10 versions & 1 rubygems