root / trunk / README

Revision 284, 3.5 kB (checked in by why, 8 months ago)

Transfering copyright and attribution to Jason. Just totally excellent work!

Line 
1= RedCloth - Textile parser for Ruby
2
3Homepage::  https://code.whytheluckystiff.net/redcloth/
4Author::    Jason Garber
5Copyright:: (c) 2008 Jason Garber
6
7(See http://hobix.com/textile/ for a Textile reference.)
8
9= RedCloth
10
11RedCloth is a Ruby library for converting Textile into HTML.
12
13== Installing
14
15RedCloth can be installed via RubyGems:
16
17  sudo gem install redcloth
18
19Or can be compiled from its Ragel source with <tt>rake compile</tt>.  Ragel 6.1
20or greater is required to build RedCloth.
21
22== What is Textile?
23
24Textile is a simple formatting style for text
25documents, loosely based on some HTML conventions.
26
27== Sample Textile Text
28
29 h2. This is a title
30
31 h3. This is a subhead
32
33 This is a bit of paragraph.
34
35 bq. This is a blockquote.
36
37= Writing Textile
38
39A Textile document consists of paragraphs.  Paragraphs
40can be specially formatted by adding a small instruction
41to the beginning of the paragraph.
42
43 h3.     Header 3.
44 bq.     Blockquote.
45 #       Numeric list.
46 *       Bulleted list.
47
48== Quick Phrase Modifiers
49
50Quick phrase modifiers are also included, to allow formatting
51of small portions of text within a paragraph.
52
53 \_emphasis\_
54 \_\_italicized\_\_
55 \*strong\*
56 \*\*bold\*\*
57 ??citation??
58 -deleted text-
59 +inserted text+
60 ^superscript^
61 ~subscript~
62 @code@
63 %(classname)span%
64
65 ==notextile== (leave text alone)
66
67== Links
68
69To make a hypertext link, put the link text in "quotation
70marks" followed immediately by a colon and the URL of the link.
71
72Optional: text in (parentheses) following the link text,
73but before the closing quotation mark, will become a title
74attribute for the link, visible as a tool tip when a cursor is above it.
75
76Example:
77
78 "This is a link (This is a title)":http://www.textism.com
79
80Will become:
81
82 <a href="http://www.textism.com" title="This is a title">This is a link</a>
83
84== Images
85
86To insert an image, put the URL for the image inside exclamation marks.
87
88Optional: text that immediately follows the URL in (parentheses) will
89be used as the Alt text for the image. Images on the web should always
90have descriptive Alt text for the benefit of readers using non-graphical
91browsers.
92
93Optional: place a colon followed by a URL immediately after the
94closing ! to make the image into a link.
95
96Example:
97
98 !http://www.textism.com/common/textist.gif(Textist)!
99
100Will become:
101
102 <img src="http://www.textism.com/common/textist.gif" alt="Textist" />
103
104With a link:
105
106 !/common/textist.gif(Textist)!:http://textism.com
107
108Will become:
109
110 <a href="http://textism.com"><img src="/common/textist.gif" alt="Textist" /></a>
111
112== Defining Acronyms
113
114HTML allows authors to define acronyms via the tag. The definition appears as a
115tool tip when a cursor hovers over the acronym. A crucial aid to clear writing,
116this should be used at least once for each acronym in documents where they appear.
117
118To quickly define an acronym in Textile, place the full text in (parentheses)
119immediately following the acronym.
120
121Example:
122
123 ACLU(American Civil Liberties Union)
124
125Will become:
126
127 <acronym title="American Civil Liberties Union">ACLU</acronym>
128
129== Adding Tables
130
131In Textile, simple tables can be added by separating each column by
132a pipe.
133
134    |a|simple|table|row|
135    |And|Another|table|row|
136
137Styles are applied with curly braces.
138
139    table{border:1px solid black}.
140    {background:#ddd;color:red}. |a|red|row|
141
142== Using RedCloth
143
144RedCloth is simply an extension of the String class, which can handle
145Textile formatting.  Use it like a String and output HTML with its
146RedCloth#to_html method.
147
148 doc = RedCloth.new "
149
150 h2. Test document
151
152 Just a simple test."
153
154 puts doc.to_html
155
Note: See TracBrowser for help on using the browser.