redcloth
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:RedCloth is a Ruby library for converting Textile into HTML.
= RedCloth - Textile parser for Ruby

Homepage::  http://redcloth.org
Maintainer:: Joshua Siler https://github.com/joshuasiler
Author::    Jason Garber
Copyright:: (c) 2011 Jason Garber
License::   MIT

{}[https://travis-ci.org/jgarber/redcloth] {}[https://codeclimate.com/github/jgarber/redcloth]

(See http://redcloth.org/textile/ for a Textile reference.)

= RedCloth

RedCloth is a Ruby library for converting Textile into HTML.

== Attention - Deprecating JRuby and Windows support in version 4.3

In order to prioritize merging a fix for the long standing vulnerability *CVE-2012-6684*, our {new maintainer}[https://github.com/joshuasiler] has elected to stop maintaining the precompiled versions for Windows and JRuby. 

== Installing

RedCloth can be installed via RubyGems:

  gem install RedCloth

== Compiling

If you just want to use RedCloth, you do NOT need to build/compile it. It is
compiled from C sources automatically when you install the gem on the ruby
platform. Precompiled binary gems are provided for JRuby and Win32 platforms prior to version 4.3.

RedCloth can be compiled with rake compile. Ragel 6.3 or greater is
required. Again, Ragel is NOT needed to simply use RedCloth.

=== Supported platforms

By default, the rake compile task builds a native C extension (MRI 1.8 or 1.9). A pure Ruby version can also be generated, but it's super slow and Ruby 1.8-only, and doesn't
support multi-byte characters. 

The RedCloth::EXTENSION_LANGUAGE constant indicates in which language your
copy of RedCloth is compiled.

== Bugs

Please submit bugs as issues to this repo.

== Using RedCloth

RedCloth is simply an extension of the String class that can handle
Textile formatting.  Use it like a String and output HTML with its
RedCloth#to_html method.

Simple use:
 text = "This is *my* text."
 RedCloth.new(text).to_html

Multi-line example:

 doc = RedCloth.new <This is a link

== Images

To insert an image, put the URL for the image inside exclamation marks.

Optional: text that immediately follows the URL in (parentheses) will
be used as the Alt text for the image. Images on the web should always
have descriptive Alt text for the benefit of readers using non-graphical
browsers.

Optional: place a colon followed by a URL immediately after the
closing ! to make the image into a link.

Example:

 !http://www.textism.com/common/textist.gif(Textist)!

Will become:

 Textist

With a link:

 !/common/textist.gif(Textist)!:http://textism.com

Will become:

 Textist

== Defining Acronyms

HTML allows authors to define acronyms via the tag. The definition appears as a
tool tip when a cursor hovers over the acronym. A crucial aid to clear writing,
this should be used at least once for each acronym in documents where they appear.

To quickly define an acronym in Textile, place the full text in (parentheses)
immediately following the acronym.

Example:

 ACLU(American Civil Liberties Union)

Will become:

 ACLU
 
== Filtering HTML

RedCloth doesn't filter unsafe html tags by default, do to this use the following syntax:
  RedCloth.new("", [:filter_html]).to_html
which will filter the script tags from the HTML resulting in:
  "<script>alert(1)</script>"

== Adding Tables

In Textile, simple tables can be added by separating each column by
a pipe.

    |a|simple|table|row|
    |And|Another|table|row|

Styles are applied with curly braces.

    table{border:1px solid black}.
    {background:#ddd;color:red}. |a|red|row|

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。