Sha256: 8490398d4fc0a1430ba4ac325297bef6d7b90c8f7794f1ab5348daf24b5be272
Contents?: true
Size: 647 Bytes
Versions: 4
Compression:
Stored size: 647 Bytes
Contents
require 'jekyll/filters' module Jekyll class SmartypantsBlock < Liquid::Block include Liquid::StandardFilters def render(context) Smartypants.educate_string(super(context).join) end end # Maruku, inexplicably, offers no way to access its Smartypants # implementation outside of the Markdown interface. So here's a hack. class Smartypants; end class << Smartypants include MaRuKu::In::Markdown::SpanLevelParser include MaRuKu::Helpers def educate_string(s) educate([s]).map{ |x| x.to_html_entity rescue x }.join end end end Liquid::Template.register_tag('educate', Jekyll::SmartypantsBlock)
Version data entries
4 entries across 4 versions & 1 rubygems