Sha256: d6c4e919df7ca2d59d15728c92ebda00d133e2b520b306eb6c7faf1eb0166450
Contents?: true
Size: 689 Bytes
Versions: 22
Compression:
Stored size: 689 Bytes
Contents
require 'redcarpet' require 'erb' # coding: utf-8 module Garage::Docs::ResourcesHelper def markdown_file(file) search_paths = ["#{file}.#{@locale}.md", "#{file}.md"].map {|base| Rails.root + base } md_file = search_paths.find {|path| File.exist?(path) } markdown(ERB.new(IO.read(md_file)).result) end def markdown(text) markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, with_toc_data: true, fenced_code_blocks: true) markdown.render(text).html_safe end def doc_name(resource) resource.respond_to?(:doc_name) ? resource.doc_name : resource.name end def action_classes %W[#{controller_name}_controller #{action_name}_action] end end
Version data entries
22 entries across 22 versions & 1 rubygems