redcarpet_yt 0.0.10 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66709f4e4b815268d49ef205298ff419f0d9df18
4
- data.tar.gz: 36cac15bc48a0e3f29863548b3b57c0f5843c5f2
3
+ metadata.gz: c783dad805d75fcfdd4a747cf7e38055465fd0f3
4
+ data.tar.gz: 339fafe90db25b60bc3ee3d61e7033f6bf2e33a2
5
5
  SHA512:
6
- metadata.gz: 47c55a8f52930b94d11fdd0513b6cf4edb9edaab7da8bf134dd0f62895e24eac137b5cbb8f53650517329732b901c811cfc6686b1e06f4d39c5edfebbbc2cc18
7
- data.tar.gz: 66357fcebe7ca909fdd44a256896f3c9bda54b8ecb308509247f9e008d83a661d0ccfabc2a33ce89ba9417e3664be94105c5ca2f66ba75a571e8e18409bc21fc
6
+ metadata.gz: a3ca5743e37a08ab115342fb18c79b8a447c56db4cc25645234ca357f74f73ce612d00cd009af6937a1e72f82e0aa78179eb7dcc7a60840c9691a514d446a3b5
7
+ data.tar.gz: cab2901778b4db05d6cfcb16c44a52273c5cb6ea3d4bb4db562989f22e2b69090633b5a8f8aecf6a1b8251fb3fdc383449e19134816959f0967bb8e7a75177fb
@@ -0,0 +1,133 @@
1
+ RedcarpetYT: Markdown with YouTube Embedding
2
+ ============================================================
3
+
4
+ RedcarpetYT is a Ruby library for Markdown processing with YouTube embedding based on [Redcarpet](https://github.com/vmg/redcarpet)
5
+
6
+ This library is written by people
7
+ ---------------------------------
8
+
9
+ RedcarpetYT was written by [Scott Werwath](https://github.com/swerwath).
10
+
11
+ RedcarpetYT is an extension of Redcarpet, which was written by [Vicent Martí](https://github.com/vmg). It is maintained by
12
+ [Robin Dupret](https://github.com/robin850) and [Matt Rogers](https://github.com/mattr-).
13
+
14
+ Redcarpet would not be possible without the [Sundown](https://www.github.com/vmg/sundown)
15
+ library and its authors (Natacha Porté, Vicent Martí, and its many awesome contributors).
16
+
17
+ You can totally install it as a Gem
18
+ -----------------------------------
19
+
20
+ Redcarpet is readily available as a Ruby gem. It will build some native
21
+ extensions, but the parser is standalone and requires no installed libraries.
22
+ Starting with Redcarpet 3.0, the minimum required Ruby version is 1.9.2 (or Rubinius in 1.9 mode).
23
+
24
+ $ [sudo] gem install redcarpet_yt
25
+
26
+ The RedcarpetYT source is available at GitHub:
27
+
28
+ $ git clone git://github.com/swerwath/redcarpet_yt.git
29
+
30
+
31
+ And it's like *really* simple to use
32
+ ------------------------------------
33
+
34
+ The core of the Redcarpet library is the `Redcarpet::Markdown` class. Each
35
+ instance of the class is attached to a `Renderer` object; the Markdown class
36
+ performs parsing of a document and uses the attached renderer to generate
37
+ output.
38
+
39
+ The `Redcarpet::Markdown` object is encouraged to be instantiated once with the
40
+ required settings, and reused between parses.
41
+
42
+ ~~~~~ ruby
43
+ # Initializes a Markdown parser
44
+ markdown = Redcarpet::Markdown.new(renderer, extensions = {})
45
+ ~~~~~
46
+
47
+ Here, the `renderer` variable refers to a renderer object, inheriting
48
+ from `Redcarpet::Render::Base`. If the given object has not been
49
+ instantiated, the library will do it with default arguments.
50
+
51
+ Rendering with the `Markdown` object is done through `Markdown#render`.
52
+ Unlike in the RedCloth API, the text to render is passed as an argument
53
+ and not stored inside the `Markdown` instance, to encourage reusability.
54
+ Example:
55
+
56
+ ~~~~~ ruby
57
+ markdown.render("This is *bongos*, indeed.")
58
+ # => "<p>This is <em>bongos</em>, indeed.</p>"
59
+ ~~~~~
60
+
61
+ You can also specify a hash containing the Markdown extensions which the
62
+ parser will identify. The following extensions are accepted:
63
+
64
+ * `:no_intra_emphasis`: do not parse emphasis inside of words.
65
+ Strings such as `foo_bar_baz` will not generate `<em>` tags.
66
+
67
+ * `:tables`: parse tables, PHP-Markdown style.
68
+
69
+ * `:fenced_code_blocks`: parse fenced code blocks, PHP-Markdown
70
+ style. Blocks delimited with 3 or more `~` or backticks will be considered
71
+ as code, without the need to be indented. An optional language name may
72
+ be added at the end of the opening fence for the code block.
73
+
74
+ * `:autolink`: parse links even when they are not enclosed in `<>`
75
+ characters. Autolinks for the http, https and ftp protocols will be
76
+ automatically detected. Email addresses and http links without protocol,
77
+ but starting with `www` are also handled.
78
+
79
+ * `:disable_indented_code_blocks`: do not parse usual markdown
80
+ code blocks. Markdown converts text with four spaces at
81
+ the front of each line to code blocks. This option
82
+ prevents it from doing so. Recommended to use
83
+ with `fenced_code_blocks: true`.
84
+
85
+ * `:strikethrough`: parse strikethrough, PHP-Markdown style.
86
+ Two `~` characters mark the start of a strikethrough,
87
+ e.g. `this is ~~good~~ bad`.
88
+
89
+ * `:lax_spacing`: HTML blocks do not require to be surrounded by an
90
+ empty line as in the Markdown standard.
91
+
92
+ * `:space_after_headers`: A space is always required between the hash
93
+ at the beginning of a header and its name, e.g. `#this is my header`
94
+ would not be a valid header.
95
+
96
+ * `:superscript`: parse superscripts after the `^` character; contiguous superscripts
97
+ are nested together, and complex values can be enclosed in parenthesis, e.g.
98
+ `this is the 2^(nd) time`.
99
+
100
+ * `:underline`: parse underscored emphasis as underlines.
101
+ `This is _underlined_ but this is still *italic*`.
102
+
103
+ * `:highlight`: parse highlights.
104
+ `This is ==highlighted==`. It looks like this: `<mark>highlighted</mark>`
105
+
106
+ * `:quote`: parse quotes.
107
+ `This is a "quote"`. It looks like this: `<q>quote</q>`
108
+
109
+ * `:footnotes`: parse footnotes, PHP-Markdown style. A footnote works very much
110
+ like a reference-style link: it consists of a marker next to the text (e.g.
111
+ `This is a sentence.[^1]`) and a footnote definition on its own line anywhere
112
+ within the document (e.g. `[^1]: This is a footnote.`).
113
+
114
+ Example:
115
+
116
+ ~~~ruby
117
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
118
+ ~~~~~
119
+
120
+ So how do I embed YouTube videos?
121
+ -----------------------------------
122
+ First, make sure your `markdown` object uses the YouTube class:
123
+ ~~~ruby
124
+ markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTMLwithYouTube, autolink: true, tables: true)
125
+ ~~~~~
126
+ Then, you can embed YouTube videos in your Markdown with the same syntax as you do with images. The renderer is smart enough to recognize if you're linking to a video. For example,
127
+ ~~~ruby
128
+ my_markdown_string = "![crazy alt text](https://www.youtube.com/watch?v=e79SuHotazs)"
129
+ ~~~~~
130
+ Then, just feed that Markdown into your renderer:
131
+ ~~~ruby
132
+ html_string = markdown.render(my_markdown_string)
133
+ ~~~~~
@@ -10,14 +10,14 @@ module Redcarpet
10
10
 
11
11
  module Render
12
12
  # Custom renderer to let our markdown include embedded Youtube videos
13
- class HTMLwithYoutube < Redcarpet::Render::HTML
13
+ class HTMLwithYouTube < Redcarpet::Render::HTML
14
14
  def image(link, title, content)
15
15
  # Check if we have a YouTube video
16
16
  if link.match /((http(s)?:\/\/)?)(www\.)?((youtube\.com\/)|(youtu.be\/))[\S]+/
17
17
  id = get_youtube_video_id(link)
18
18
  '</p>
19
19
  <div position="relative" padding-bottom="56.25%" padding-top="25px" height="0">
20
- <iframe position="absolute" top="0" bottom="0" width="100%" height="320" src="//www.youtube.com/embed/'+id+'" frameborder="0" allowfullscreen></iframe>
20
+ <iframe position="absolute" top="0" bottom="0" width="100%" height="320tu" src="//www.youtube.com/embed/'+id+'" frameborder="0" allowfullscreen></iframe>
21
21
  </div>
22
22
  <p>'
23
23
  else
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'redcarpet_yt'
4
- s.version = '0.0.10'
4
+ s.version = '0.1.0'
5
5
  s.summary = "Markdown that smells nice, now with YouTube embedding"
6
6
  s.description = 'A fast, safe and extensible Markdown to (X)HTML parser, with YouTube embedding, based on Redcarpet'
7
7
  s.date = '2016-03-31'
@@ -14,7 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.files = %w[
15
15
  COPYING
16
16
  Gemfile
17
- README.markdown
17
+ README.md
18
18
  Rakefile
19
19
  bin/redcarpet
20
20
  ext/redcarpet/autolink.c
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redcarpet_yt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Natacha Porté
@@ -66,7 +66,7 @@ extra_rdoc_files:
66
66
  files:
67
67
  - COPYING
68
68
  - Gemfile
69
- - README.markdown
69
+ - README.md
70
70
  - Rakefile
71
71
  - bin/redcarpet
72
72
  - ext/redcarpet/autolink.c
@@ -1,394 +0,0 @@
1
- Redcarpet is written with sugar, spice and everything nice
2
- ============================================================
3
-
4
- [![Build Status](https://travis-ci.org/vmg/redcarpet.svg?branch=master)](https://travis-ci.org/vmg/redcarpet)
5
- [![Dependency Status](https://www.versioneye.com/ruby/redcarpet/badge.svg)](https://www.versioneye.com/ruby/redcarpet)
6
-
7
- Redcarpet is a Ruby library for Markdown processing that smells like
8
- butterflies and popcorn.
9
-
10
- This library is written by people
11
- ---------------------------------
12
-
13
- Redcarpet was written by [Vicent Martí](https://github.com/vmg). It is maintained by
14
- [Robin Dupret](https://github.com/robin850) and [Matt Rogers](https://github.com/mattr-).
15
-
16
- Redcarpet would not be possible without the [Sundown](https://www.github.com/vmg/sundown)
17
- library and its authors (Natacha Porté, Vicent Martí, and its many awesome contributors).
18
-
19
- You can totally install it as a Gem
20
- -----------------------------------
21
-
22
- Redcarpet is readily available as a Ruby gem. It will build some native
23
- extensions, but the parser is standalone and requires no installed libraries.
24
- Starting with Redcarpet 3.0, the minimum required Ruby version is 1.9.2 (or Rubinius in 1.9 mode).
25
-
26
- $ [sudo] gem install redcarpet
27
-
28
- If you need to use it with Ruby 1.8.7, you will need to stick with 2.3.0:
29
-
30
- $ [sudo] gem install redcarpet -v 2.3.0
31
-
32
- The Redcarpet source is available at GitHub:
33
-
34
- $ git clone git://github.com/vmg/redcarpet.git
35
-
36
-
37
- And it's like *really* simple to use
38
- ------------------------------------
39
-
40
- The core of the Redcarpet library is the `Redcarpet::Markdown` class. Each
41
- instance of the class is attached to a `Renderer` object; the Markdown class
42
- performs parsing of a document and uses the attached renderer to generate
43
- output.
44
-
45
- The `Redcarpet::Markdown` object is encouraged to be instantiated once with the
46
- required settings, and reused between parses.
47
-
48
- ~~~~~ ruby
49
- # Initializes a Markdown parser
50
- markdown = Redcarpet::Markdown.new(renderer, extensions = {})
51
- ~~~~~
52
-
53
- Here, the `renderer` variable refers to a renderer object, inheriting
54
- from `Redcarpet::Render::Base`. If the given object has not been
55
- instantiated, the library will do it with default arguments.
56
-
57
- Rendering with the `Markdown` object is done through `Markdown#render`.
58
- Unlike in the RedCloth API, the text to render is passed as an argument
59
- and not stored inside the `Markdown` instance, to encourage reusability.
60
- Example:
61
-
62
- ~~~~~ ruby
63
- markdown.render("This is *bongos*, indeed.")
64
- # => "<p>This is <em>bongos</em>, indeed.</p>"
65
- ~~~~~
66
-
67
- You can also specify a hash containing the Markdown extensions which the
68
- parser will identify. The following extensions are accepted:
69
-
70
- * `:no_intra_emphasis`: do not parse emphasis inside of words.
71
- Strings such as `foo_bar_baz` will not generate `<em>` tags.
72
-
73
- * `:tables`: parse tables, PHP-Markdown style.
74
-
75
- * `:fenced_code_blocks`: parse fenced code blocks, PHP-Markdown
76
- style. Blocks delimited with 3 or more `~` or backticks will be considered
77
- as code, without the need to be indented. An optional language name may
78
- be added at the end of the opening fence for the code block.
79
-
80
- * `:autolink`: parse links even when they are not enclosed in `<>`
81
- characters. Autolinks for the http, https and ftp protocols will be
82
- automatically detected. Email addresses and http links without protocol,
83
- but starting with `www` are also handled.
84
-
85
- * `:disable_indented_code_blocks`: do not parse usual markdown
86
- code blocks. Markdown converts text with four spaces at
87
- the front of each line to code blocks. This option
88
- prevents it from doing so. Recommended to use
89
- with `fenced_code_blocks: true`.
90
-
91
- * `:strikethrough`: parse strikethrough, PHP-Markdown style.
92
- Two `~` characters mark the start of a strikethrough,
93
- e.g. `this is ~~good~~ bad`.
94
-
95
- * `:lax_spacing`: HTML blocks do not require to be surrounded by an
96
- empty line as in the Markdown standard.
97
-
98
- * `:space_after_headers`: A space is always required between the hash
99
- at the beginning of a header and its name, e.g. `#this is my header`
100
- would not be a valid header.
101
-
102
- * `:superscript`: parse superscripts after the `^` character; contiguous superscripts
103
- are nested together, and complex values can be enclosed in parenthesis, e.g.
104
- `this is the 2^(nd) time`.
105
-
106
- * `:underline`: parse underscored emphasis as underlines.
107
- `This is _underlined_ but this is still *italic*`.
108
-
109
- * `:highlight`: parse highlights.
110
- `This is ==highlighted==`. It looks like this: `<mark>highlighted</mark>`
111
-
112
- * `:quote`: parse quotes.
113
- `This is a "quote"`. It looks like this: `<q>quote</q>`
114
-
115
- * `:footnotes`: parse footnotes, PHP-Markdown style. A footnote works very much
116
- like a reference-style link: it consists of a marker next to the text (e.g.
117
- `This is a sentence.[^1]`) and a footnote definition on its own line anywhere
118
- within the document (e.g. `[^1]: This is a footnote.`).
119
-
120
- Example:
121
-
122
- ~~~ruby
123
- markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, autolink: true, tables: true)
124
- ~~~~~
125
-
126
- Darling, I packed you a couple renderers for lunch
127
- --------------------------------------------------
128
-
129
- Redcarpet comes with two built-in renderers, `Redcarpet::Render::HTML` and
130
- `Redcarpet::Render::XHTML`, which output HTML and XHTML, respectively. These
131
- renderers are actually implemented in C and hence offer brilliant
132
- performance — several degrees of magnitude faster than other Ruby Markdown
133
- solutions.
134
-
135
- All the rendering flags that previously applied only to HTML output have
136
- now been moved to the `Redcarpet::Render::HTML` class, and may be enabled when
137
- instantiating the renderer:
138
-
139
- ~~~~~ ruby
140
- Redcarpet::Render::HTML.new(render_options = {})
141
- ~~~~~
142
-
143
- Initializes an HTML renderer. The following flags are available:
144
-
145
- * `:filter_html`: do not allow any user-inputted HTML in the output.
146
-
147
- * `:no_images`: do not generate any `<img>` tags.
148
-
149
- * `:no_links`: do not generate any `<a>` tags.
150
-
151
- * `:no_styles`: do not generate any `<style>` tags.
152
-
153
- * `:escape_html`: escape any HTML tags. This option has precedence over
154
- `:no_styles`, `:no_links`, `:no_images` and `:filter_html` which means
155
- that any existing tag will be escaped instead of being removed.
156
-
157
- * `:safe_links_only`: only generate links for protocols which are considered
158
- safe.
159
-
160
- * `:with_toc_data`: add HTML anchors to each header in the output HTML,
161
- to allow linking to each section.
162
-
163
- * `:hard_wrap`: insert HTML `<br>` tags inside paragraphs where the original
164
- Markdown document had newlines (by default, Markdown ignores these newlines).
165
-
166
- * `:xhtml`: output XHTML-conformant tags. This option is always enabled in the
167
- `Render::XHTML` renderer.
168
-
169
- * `:prettify`: add prettyprint classes to `<code>` tags for google-code-prettify.
170
-
171
- * `:link_attributes`: hash of extra attributes to add to links.
172
-
173
- Example:
174
-
175
- ~~~~~ ruby
176
- renderer = Redcarpet::Render::HTML.new(no_links: true, hard_wrap: true)
177
- ~~~~~
178
-
179
-
180
- The `HTML` renderer has an alternate version, `Redcarpet::Render::HTML_TOC`,
181
- which will output a table of contents in HTML based on the headers of the
182
- Markdown document.
183
-
184
- When instantiating this render object, you can optionally pass a `nesting_level`
185
- option which takes an integer and allows you to make it render only headers
186
- until a specific level.
187
-
188
- Furthermore, the abstract base class `Redcarpet::Render::Base` can be used
189
- to write a custom renderer purely in Ruby, or extending an existing renderer.
190
- See the following section for more information.
191
-
192
-
193
- And you can even cook your own
194
- ------------------------------
195
-
196
- Custom renderers are created by inheriting from an existing renderer. The
197
- built-in renderers, `HTML` and `XHTML` may be extended as such:
198
-
199
- ~~~~~ ruby
200
- # create a custom renderer that allows highlighting of code blocks
201
- class HTMLwithPygments < Redcarpet::Render::HTML
202
- def block_code(code, language)
203
- Pygments.highlight(code, lexer: language)
204
- end
205
- end
206
-
207
- markdown = Redcarpet::Markdown.new(HTMLwithPygments, fenced_code_blocks: true)
208
- ~~~~~
209
-
210
- But new renderers can also be created from scratch (see `lib/redcarpet/render_man.rb` for
211
- an example implementation of a Manpage renderer)
212
-
213
- ~~~~~~ ruby
214
- class ManPage < Redcarpet::Render::Base
215
- # you get the drill -- keep going from here
216
- end
217
- ~~~~~
218
-
219
- The following instance methods may be implemented by the renderer:
220
-
221
- ### Block-level calls
222
-
223
- If the return value of the method is `nil`, the block will be skipped.
224
- Therefore, make sure that your renderer has at least a `paragraph` method
225
- implemented. If the method for a document element is not implemented, the
226
- block will be skipped.
227
-
228
- Example:
229
-
230
- ~~~~ ruby
231
- class RenderWithoutCode < Redcarpet::Render::HTML
232
- def block_code(code, language)
233
- nil
234
- end
235
- end
236
- ~~~~
237
-
238
- * block_code(code, language)
239
- * block_quote(quote)
240
- * block_html(raw_html)
241
- * footnotes(content)
242
- * footnote_def(content, number)
243
- * header(text, header_level)
244
- * hrule()
245
- * list(contents, list_type)
246
- * list_item(text, list_type)
247
- * paragraph(text)
248
- * table(header, body)
249
- * table_row(content)
250
- * table_cell(content, alignment)
251
-
252
- ### Span-level calls
253
-
254
- A return value of `nil` will not output any data. If the method for
255
- a document element is not implemented, the contents of the span will
256
- be copied verbatim:
257
-
258
- * autolink(link, link_type)
259
- * codespan(code)
260
- * double_emphasis(text)
261
- * emphasis(text)
262
- * image(link, title, alt_text)
263
- * linebreak()
264
- * link(link, title, content)
265
- * raw_html(raw_html)
266
- * triple_emphasis(text)
267
- * strikethrough(text)
268
- * superscript(text)
269
- * underline(text)
270
- * highlight(text)
271
- * quote(text)
272
- * footnote_ref(number)
273
-
274
- **Note**: When overriding a renderer's method, be sure to return a HTML
275
- element with a level that matches the level of that method (e.g. return a
276
- block element when overriding a block-level callback). Otherwise, the output
277
- may be unexpected.
278
-
279
- ### Low level rendering
280
-
281
- * entity(text)
282
- * normal_text(text)
283
-
284
- ### Header of the document
285
-
286
- Rendered before any another elements:
287
-
288
- * doc_header()
289
-
290
- ### Footer of the document
291
-
292
- Rendered after all the other elements:
293
-
294
- * doc_footer()
295
-
296
- ### Pre/post-process
297
-
298
- Special callback: preprocess or postprocess the whole document before
299
- or after the rendering process begins:
300
-
301
- * preprocess(full_document)
302
- * postprocess(full_document)
303
-
304
- You can look at
305
- ["How to extend the Redcarpet 2 Markdown library?"](http://dev.af83.com/2012/02/27/howto-extend-the-redcarpet2-markdown-lib.html)
306
- for some more explanations.
307
-
308
- Also, now our Pants are much smarter
309
- ------------------------------------
310
-
311
- Redcarpet 2 comes with a standalone [SmartyPants](
312
- http://daringfireball.net/projects/smartypants/) implementation. It is fully
313
- compliant with the original implementation. It is the fastest SmartyPants
314
- parser there is, with a difference of several orders of magnitude.
315
-
316
- The SmartyPants parser can be found in `Redcarpet::Render::SmartyPants`. It has
317
- been implemented as a module, so it can be used standalone or as a mixin.
318
-
319
- When mixed with a Renderer class, it will override the `postprocess` method
320
- to perform SmartyPants replacements once the rendering is complete.
321
-
322
- ~~~~ ruby
323
- # Mixin
324
- class HTMLWithPants < Redcarpet::Render::HTML
325
- include Redcarpet::Render::SmartyPants
326
- end
327
-
328
- # Standalone
329
- Redcarpet::Render::SmartyPants.render("<p>Oh SmartyPants, you're so crazy...</p>")
330
- ~~~~~
331
-
332
- SmartyPants works on top of already-rendered HTML, and will ignore replacements
333
- inside the content of HTML tags and inside specific HTML blocks such as
334
- `<code>` or `<pre>`.
335
-
336
- What? You really want to mix Markdown renderers?
337
- ------------------------------------------------
338
-
339
- Redcarpet used to be a drop-in replacement for Redcloth. This is no longer the
340
- case since version 2 -- it now has its own API, but retains the old name. Yes,
341
- that does mean that Redcarpet is not backwards-compatible with the 1.X
342
- versions.
343
-
344
- Each renderer has its own API and its own set of extensions: you should choose one
345
- (it doesn't have to be Redcarpet, though that would be great!), write your
346
- software accordingly, and force your users to install it. That's the
347
- only way to have reliable and predictable Markdown output on your program.
348
-
349
- Markdown is already ill-specified enough; if you create software that is
350
- renderer-independent, the results will be completely unreliable!
351
-
352
- Still, if major forces (let's say, tornadoes or other natural disasters) force you
353
- to keep a Markdown-compatibility layer, Redcarpet also supports this:
354
-
355
- ~~~~~ ruby
356
- require 'redcarpet/compat'
357
- ~~~~~
358
-
359
- Requiring the compatibility library will declare a `Markdown` class with the
360
- classical RedCloth API, e.g.
361
-
362
- ~~~~~ ruby
363
- Markdown.new('this is my text').to_html
364
- ~~~~~
365
-
366
- This class renders 100% standards compliant Markdown with 0 extensions. Nada.
367
- Don't even try to enable extensions with a compatibility layer, because
368
- that's a maintenance nightmare and won't work.
369
-
370
- On a related topic: if your Markdown gem has a `lib/markdown.rb` file that
371
- monkeypatches the Markdown class, you're a terrible human being. Just saying.
372
-
373
- Boring legal stuff
374
- ------------------
375
-
376
- Copyright (c) 2011-2015, Vicent Martí
377
-
378
- Permission is hereby granted, free of charge, to any person obtaining a copy
379
- of this software and associated documentation files (the "Software"), to deal
380
- in the Software without restriction, including without limitation the rights
381
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
382
- copies of the Software, and to permit persons to whom the Software is
383
- furnished to do so, subject to the following conditions:
384
-
385
- The above copyright notice and this permission notice shall be included in
386
- all copies or substantial portions of the Software.
387
-
388
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
389
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
390
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
391
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
392
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
393
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
394
- THE SOFTWARE.