Class: PublifyCore::TextFilter::Markdown
- Inherits:
-
TextFilterPlugin::Markup
- Object
- TextFilterPlugin
- TextFilterPlugin::Markup
- PublifyCore::TextFilter::Markdown
- Defined in:
- lib/publify_core/text_filter/markdown.rb
Direct Known Subclasses
Class Method Summary collapse
Methods inherited from TextFilterPlugin::Markup
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, 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
46 47 48 49 50 51 |
# File 'lib/publify_core/text_filter/markdown.rb', line 46 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_html(escaped_macros, :UNSAFE) html.gsub(%r{(</?publify)X}, '\1:').strip end |
.help_text ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/publify_core/text_filter/markdown.rb', line 12 def self.help_text <<~TXT [Markdown](http://daringfireball.net/projects/markdown/) is a simple text-to-HTML converter that turns common text idioms into HTML. The [full syntax](http://daringfireball.net/projects/markdown/syntax) is available from the author's site, but here's a short summary: * **Paragraphs**: Start a new paragraph by skipping a line. * **Italics**: Put text in *italics* by enclosing it in either * or _: `*italics*` turns into *italics*. * **Bold**: Put text in **bold** by enclosing it in two *s: `**bold**` turns into **bold**. * **Pre-formatted text**: Enclosing a short block of text in backquotes (`) displays it in a monospaced font and converts HTML metacharacters so they display correctly. Example: ``<img src="foo"/>`` displays as `<img src="foo"/>`. Also, any paragraph indented 4 or more spaces is treated as pre-formatted text. * **Block quotes**: Any paragraph (or line) that starts with a `>` is treated as a blockquote. * **Hyperlinks**: You can create links like this: `[amazon's web site](http://www.amazon.com)`. That produces "[amazon's web site](http://www.amazon.com)". * **Lists**: You can create numbered or bulleted lists by ending a paragraph with a colon (:), skipping a line, and then using asterisks (*, for bullets) or numbers (for numbered lists). See the [Markdown syntax page](http://daringfireball.net/projects/markdown/syntax) for examples. * **Raw HTML**: Markdown will pass raw HTML through unchanged, so you can use HTML's syntax whenever Markdown doesn't provide a reasonable alternative. TXT end |