Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Rails 3.1 engine for Markitup Text Editor

branch: master
README.rdoc

markitup_rails

Markitup_rails is a Rails 3.1 engine that allows you to integrate the MarkItUp text editor into the asset pipeline.

This uses the 1.1.12 release of Markitup, by Jay Salvat

This engine allows you to add in the CSS and Javascript as written in the MarkItUp plugin. I would strongly recommend that you read the documentation tha comes with MarkItUp.

This engine includes the following MarkItUp elements:

  • MarkItUp images and stylesheets

  • MarkItUp javascript

  • a MarkItUp set for Markdown

MarkItUp support a variety of markup parsers, however, this plugin only includes support for Markdown and HTML. Pull requests are welcome!

Usage

Add the markitup_rails gem to your Gemfile. In Gemfile:

gem "markitup_rails"

Markdown

/* app/assets/stylesheets/application.css */
/* the following directives will include the markitup CSS */
/* the skins/markitup CSS will define how the text area will look */
/* the sets/markdown CSS defines the markdown-specific buttons */

/*
*= require skins/markitup/style.css
*= require sets/markdown/style.css
*/

// in app/assets/javascripts/application.js

// include the main MarkItUp javascript
//= require jquery.markitup

// include a set, which defines the javascript rules for the particular parser. Markdown is included with this:
// The sets/markdown/set.js file will define a Javascript variable called "myMarkdownSettings".
//= require ./sets/markdown/set.js

$(document).ready(function(){
  $("textarea").markItUp(myMarkdownSettings);
});

BBCode

/* app/assets/stylesheets/application.css */
/* the following directives will include the markitup CSS */
/* the skins/markitup CSS will define how the text area will look */
/* the sets/bbcode CSS defines the bbcode-specific buttons */

/*
*= require skins/markitup/style.css
*= require sets/bbcode/style.css
*/

// in app/assets/javascripts/application.js

// include the main MarkItUp javascript
//= require jquery.markitup

// include a set, which defines the javascript rules for the particular parser. BBCode is included with this:
// The sets/bbcode/set.js file will define a Javascript variable called "myBBCodeSettings".
//= require ./sets/bbcode/set.js

$(document).ready(function(){
  $("textarea").markItUp(myBBCodeSettings);
});

HTML

/* app/assets/stylesheets/application.css */
/* the following directives will include the markitup CSS */
/* the skins/markitup CSS will define how the text area will look */
/* the sets/markdown CSS defines the markdown-specific buttons */

/*
*= require skins/markitup/style.css
*= require sets/default/style.css
*/

// in app/assets/javascripts/application.js

// include the main MarkItUp javascript
//= require jquery.markitup

// include a set, which defines the javascript rules for the particular parser. 
// The sets/default/set.js file will define a Javascript variable called "mySettings".
//= require ./sets/default/set.js

$(document).ready(function(){
  $("textarea").markItUp(mySettings);
});

The engine also comes with a simple controller that MarkItUp can send text to your application, and return a response parsed with BlueCloth, and render a preview using Ajax.

Contributing to markitup_rails

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Contributors

Ze Jin, www.jinze.info/

License

Dual licensed under the MIT and GPL licenses.

markItUp! Universal MarkUp Engine, JQuery plugin v 1.1.x Copyright (C) 2007-2011 Jay Salvat markitup.jaysalvat.com/

markitup_rails Copyright (C) 2011 Jeff Wigal dropkickstudios.com

Something went wrong with that request. Please try again.