GithubHelp home page GithubHelp logo

guniorobot / moredown Goto Github PK

View Code? Open in Web Editor NEW

This project forked from davidfstr/rdiscount

1.0 2.0 0.0 227 KB

Discount (For Ruby) Implementation of John Gruber's Markdown

Home Page: http://github.com/nathanhoad/moredown/

License: Other

C 65.60% Ruby 27.66% Perl 6.73%

moredown's Introduction

Moredown - Discount Markdown Processor for Ruby (with some extras)

Discount is an implementation of John Gruber's Markdown markup language in C. It implements all of the language described in the markdown syntax document and passes the Markdown 1.0 test suite.

Discount was developed by David Loren Parsons. The Ruby extension was developed by Ryan Tomayko and extended by Nathan Hoad.

Installation, Hacking

The Moredown gem can be installed from Rubygems:

$ gem install moredown

The Moredown sources are available via Git:

$ git clone git://github.com/nathanhoad/moredown.git
$ cd moredown
$ rake --tasks

For more information, see the project page.

Usage

Moredown can be used in any way that RDiscount can be (see below). In addition, Moredown implements some extras:

  • Static method for simple calls

     require 'moredown'
     html = Moredown.text_to_html("Hello World!")
    
  • Remap relative URLs

     Moredown.new(text, :base_url => 'http://nathanhoad.net').to_html
    
  • Remap headings (eg. h1 becomes h3).

     Moredown.new(text, :map_headings => 2)
    
  • Embed Youtube videos (similar to image syntax except the title text is used for width and height)

     ![Video](youtube:lfAzVe5H-vE)
     ![Blah](youtube:lfAzVe5H-vE "400 300")
    
  • Use Flash movies (include the width and height if you want)

     ![Flash](flash:movieclip.swf)
     ![Something](flash:something.swf "200 100")
    
  • Use SwfObject (javascript not included) for graceful Flash degradation

     Moredown.new(text, :swfobject => { :src => 'swfobject.js', :version => '10', :fallback => 'No Flash' })
    
  • Image alignments (extension to image syntax)

     ![Image](/images/test.jpg):left
     ![Image](/images/test.jpg):right
     ![Image](/images/test.jpg):center
    
  • Emoticons

     :-)
     :-P
     :-D
     :-(
     :-@
     ;-)
    
  • RDiscount extensions are now passed under :extensions

     Moredown.new(text, :extensions => [:smart])
    

RDiscount implements the basic protocol popularized by RedCloth and adopted by BlueCloth:

require 'moredown'
markdown = Moredown.new("Hello World!")
puts markdown.to_html

Inject Moredown into your BlueCloth-using code by replacing your bluecloth require statements with the following:

begin
  require 'moredown'
  BlueCloth = Moredown
rescue LoadError
  require 'bluecloth'
end

COPYING

Discount is free software; it is released under a BSD-style license that allows you to do as you wish with it as long as you don't attempt to claim it as your own work. RDiscount adopts Discount's license verbatim. See the file COPYING for more information.

moredown's People

Contributors

rtomayko avatar nathanhoad avatar js avatar pixeltrix avatar chrisk avatar orc avatar geoffgarside avatar keolo avatar technoweenie avatar

Stargazers

Gun.io Robot avatar

Watchers

Gun.io Robot avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.