/markdown_handler

A markdown template handler for rails

Primary LanguageRubyMIT LicenseMIT

Rails Markdown Handler

Adds markdown template handling to rails using the Redcarpet gem.

RailsMarkdownHandler will also parses ERB and embeded HTML.

Installation

gem "markdown_handler"
$ bundle install

Usage

app/config/routes.rb

get "/example", to: "pages#example"

app/controllers/pages_controller.rb

class PagesController < ApplicationController
  def example
  end
end

app/views/pages/example.md

# Posts

<% @posts.each do |post| %>
  ## <%= post.title %>
  <%= post.body %>
<% end %>

Configuration

You can configure the redcarpet renderer using an initializer.

# app/config/initializers/markdown.rb
MarkdownHandler.configure do |config|
  config[:autolink] = false
end