Project

carpetbomb

0.0
No commit activity in last 3 years
No release in over 3 years
Markdown and erb (side by side) template handler for Ruby on Rails using Redcarpet.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 3.1
 Project Readme

Carpetbomb

Markdown and erb template handler for Ruby on Rails using Redcarpet.

Dependencies

It depends on Redcarpet v3.1

Rails versions.

It works from Rails 4.1 to Rails 3.x.

Installation

Add to your project Gemfile:

$ gem 'carpetbomb'

Run the following command to install it:

$ bundle install

Run the generator:

$ rails generate carpetbomb:install

That's it.

Uninstall

Run the generator:

$ rails generate carpetbomb:uninstall

Remove the gem from the Gemfile, and run bundle.

Usage

This gem adds three posible markdown template extensions to the existing Rails template handlers:

.md, .mdown and .markdown all of them will work and will be parsed first with Ruby on Rails erb template, so you can add whatever erb syntax you want. After that it will be parsed by Redcarpet to handle the markdown part.

It's really simple to start using markdown templates. Create a view or rename it to whatever viewname you want {viewname}.html.md and that's it.

index.html.md

<%= content_for :page_title, 'MyApp - Index' %>

# Hi from the index page.

This is the home directory!

Configuration

The configuration file for this gem in installed when you use the rails generate carpetbomb:install command, and it's located in config/initializers/carpetbomb.rb. You can change any Redcarpet options within that file.

You can check those options here.

Contributions

Just send a pull request!

Thanks

Thanks to Lindsey Bieda for this tutorial and to Joliss for her markdown-rails I practically copied the core of gem.