Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 111 lines (75 sloc) 3.481 kB
36a4dd8 @dtrasbo Initial commit
authored
1 Formatize
2 =========
3
168d6b6 @dtrasbo ABANDONED. This project is no longer active.
authored
4 **ABANDONED.** *I'm sorry, but this project is no longer active. Feel free to fork the repo, copy the code, release the code under a different gem or whatever you need*
5
9641db2 @dtrasbo Prepare readme for 1.0.0 release
authored
6 As of version 3, Rails doesn't have the `textilize`,
7 `textilize_without_paragraph`, and `markdown` helper methods. Formatize brings
8 them back. Drop it into the old application you're upgrading and it'll smoothen
9 the process just that little bit more.
36a4dd8 @dtrasbo Initial commit
authored
10
e01ab7e @dtrasbo Fix CI badge
authored
11 [![Build status badge](https://secure.travis-ci.org/dtrasbo/formatize.png)](http://travis-ci.org/dtrasbo/formatize)
fe1e501 @dtrasbo Add build status badge to readme
authored
12
36a4dd8 @dtrasbo Initial commit
authored
13 Installation
14 ------------
15
9641db2 @dtrasbo Prepare readme for 1.0.0 release
authored
16 Put `gem 'formatize'` into your Gemfile and do a `bundle install`, and that's
17 it. Formatize depends on `RedCloth` and `bluecloth` so you will not have to
18 worry about those.
36a4dd8 @dtrasbo Initial commit
authored
19
20 Usage
21 -----
22
1d80dea @dtrasbo Formatize::Helpers => Formatize::Helper and helpers => helper methods
authored
23 ### The `textilize` & `textilize_without_paragraph` helper methods
36a4dd8 @dtrasbo Initial commit
authored
24
1d80dea @dtrasbo Formatize::Helpers => Formatize::Helper and helpers => helper methods
authored
25 The `textilize` helper method accepts a string of
32f11b2 @dtrasbo Revamp the documentation
authored
26 [Textile](http://redcloth.org/textile) and one or more flags. Often, the
27 default behavior will be suitable and you will not have to pass it any flags:
36a4dd8 @dtrasbo Initial commit
authored
28
29 textilize("*This is Textile!* Rejoice!")
30 # => "<p><strong>This is Textile!</strong> Rejoice!</p>"
31
32f11b2 @dtrasbo Revamp the documentation
authored
32 When necessary, flags are listed as such:
36a4dd8 @dtrasbo Initial commit
authored
33
32f11b2 @dtrasbo Revamp the documentation
authored
34 textilize("(snip)", :flag1, :flag2, :flag3)
35 # => "(snip)"
36a4dd8 @dtrasbo Initial commit
authored
36
32f11b2 @dtrasbo Revamp the documentation
authored
37 [The `RedCloth` documentation](http://redcloth.rubyforge.org/classes/RedCloth/TextileDoc.html)
0e982a3 Fixed typo
drdla authored
38 lists the available flags. The `textilize_without_paragraph` method
32f11b2 @dtrasbo Revamp the documentation
authored
39 delegates to `textilize` but strips the surrounding `<p>` tags.
36a4dd8 @dtrasbo Initial commit
authored
40
1d80dea @dtrasbo Formatize::Helpers => Formatize::Helper and helpers => helper methods
authored
41 ### The `markdown` helper method
36a4dd8 @dtrasbo Initial commit
authored
42
1d80dea @dtrasbo Formatize::Helpers => Formatize::Helper and helpers => helper methods
authored
43 The `markdown` helper method accepts a string of
32f11b2 @dtrasbo Revamp the documentation
authored
44 [Markdown](http://daringfireball.net/projects/markdown/) and one or more
45 flags. Often, the default behavior will be suitable and you will not have
46 to pass it any flags:
36a4dd8 @dtrasbo Initial commit
authored
47
48 markdown("We are using __Markdown__ now!")
49 # => "<p>We are using <strong>Markdown</strong> now!</p>"
50
32f11b2 @dtrasbo Revamp the documentation
authored
51 When necessary, flags are listed as such:
52
53 markdown("(snip)", :flag1, :flag2, :flag3)
54 # => "(snip)"
55
56 [The `bluecloth` documentation](http://rubydoc.info/gems/bluecloth/BlueCloth)
57 lists the available flags.
58
59 Sanitization
60 ------------
61
62 Both `textilize` and `markdown` sanitizes the input using Rails'
63 `sanitize` prior to parsing. Since both gems can do this themselves,
64 it's useful to be able to bypass the pre-parsing sanitization. Two ways:
36a4dd8 @dtrasbo Initial commit
authored
65
32f11b2 @dtrasbo Revamp the documentation
authored
66 1. Pass a string that has been marked HTML safe. (Preferred).
67 2. Use the special `:safe` flag, which is not passed on to the parser.
68 _(Deprecated in 1.1, removed in 2.0)._
36a4dd8 @dtrasbo Initial commit
authored
69
e9aca99 @dtrasbo Add note regarding customization of allowed tags/attributes
authored
70 With Rails' `sanitize`, if you don't bypass it, you can choose which tags and
71 attributes to allow as described in the
72 [documentation](http://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html#method-i-sanitize).
73
945e2b2 @dtrasbo Add compatibility section to readme
authored
74 Compatibility
75 -------------
76
f730ef0 @dtrasbo Update readme
authored
77 Feel free to try other versions. Minor patches to support other versions
78 are welcome.
9641db2 @dtrasbo Prepare readme for 1.0.0 release
authored
79
f730ef0 @dtrasbo Update readme
authored
80 ### Ruby versions
81 * 1.9.3-p125
82 * 1.8.7-p358
83
84 Latest versions in the 1.8 and 1.9 series. Generally, Formatize will not
85 jump through hoops to support other versions. 1.8 support may be dropped
86 eventually.
87
88 ### Rails versions
2727a41 @dtrasbo Test against latest in Rails 3.0, 3.1, and 3.2 series
authored
89 * 3.2.2
90 * 3.1.4
91 * 3.0.12
f730ef0 @dtrasbo Update readme
authored
92
93 The latest versions in all the 3.0 series. This is likely to change when
94 4.0 is released.
945e2b2 @dtrasbo Add compatibility section to readme
authored
95
629f2c8 @dtrasbo Add dependencies section to readme
authored
96 Dependencies
97 ------------
98
99 * `RedCloth` gem
100 * `bluecloth` gem
101
27c2728 @dtrasbo Turn badges into links
authored
102 [![Dependency status badge](https://gemnasium.com/dtrasbo/formatize.png)](https://gemnasium.com/dtrasbo/formatize)
629f2c8 @dtrasbo Add dependencies section to readme
authored
103
36a4dd8 @dtrasbo Initial commit
authored
104 Copyright & Licensing
105 ---------------------
106
f730ef0 @dtrasbo Update readme
authored
107 Copyright (c) 2012 David Trasbo
108
109 Released under the MIT License. See LICENSE for details.
36a4dd8 @dtrasbo Initial commit
authored
110
Something went wrong with that request. Please try again.