Sha256: 19487a6061cf31882984cde4e4d9b3bf200059a2637fdace6603e93eb2daefef
Contents?: true
Size: 920 Bytes
Versions: 3
Compression:
Stored size: 920 Bytes
Contents
module OodAppkit # Class used to handle markdown views in `ActionView::Template` module MarkdownTemplateHandler # String of ruby code to be evaluated when rendering the view # @param template [ActionView::Template] the template to be rendered # @return [String] string of ruby code to be evaluated def self.call(_, source) "begin;#{render(source)}.html_safe;end" end # Render markdown to HTML # @param text [String] markdown text # @return [String] escaped version of html text surrounded by quote marks def self.render(text) markdown.render(text).inspect end # Markdown renderer used def self.markdown @markdown ||= OodAppkit.markdown end private_class_method :markdown end end # Register this handler for the various markdown extensions ActionView::Template.register_template_handler :md, :markdown, OodAppkit::MarkdownTemplateHandler
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ood_appkit-2.1.4 | lib/ood_appkit/markdown_template_handler.rb |
ood_appkit-2.1.1 | lib/ood_appkit/markdown_template_handler.rb |
ood_appkit-2.1.0 | lib/ood_appkit/markdown_template_handler.rb |