Class: PublifyCore::TextFilter::MarkdownSmartquotes

Inherits:
Markdown show all
Defined in:
lib/publify_core/text_filter/markdown_smartquotes.rb

Class Method Summary collapse

Methods inherited from Markdown

help_text

Methods inherited from TextFilterPlugin::Markup

filter_type

Methods inherited from TextFilterPlugin

abstract_filter!, available_filter_types, available_filters, component_name, config_value, default_config, default_helper_module!, expand_filter_list, filter_map, filter_type, help_text, inherited, logger, macro_filters, macro_post_filters, macro_pre_filters, reloadable?, sanitize, short_name

Methods included from PublifyPlugins

#plugin_description, #plugin_display_name, #plugin_public_action, #plugin_public_actions

Class Method Details

.filtertext(text) ⇒ Object



13
14
15
16
17
18
# File 'lib/publify_core/text_filter/markdown_smartquotes.rb', line 13

def self.filtertext(text)
  # FIXME: Workaround for <publify:foo> not being interpreted as an HTML tag.
  escaped_macros = text.gsub(%r{(</?publify):}, '\1X')
  html = CommonMarker.render_doc(escaped_macros, :SMART).to_html(:UNSAFE)
  html.gsub(%r{(</?publify)X}, '\1:').strip
end