tight-redcarpet 3.2.0 → 3.3.2t

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,7 +13,7 @@ module Redcarpet
13
13
  :autolink, :codespan, :double_emphasis,
14
14
  :emphasis, :underline, :raw_html,
15
15
  :triple_emphasis, :strikethrough,
16
- :superscript,
16
+ :superscript, :highlight,
17
17
 
18
18
  # footnotes
19
19
  :footnotes, :footnote_def, :footnote_ref,
@@ -43,6 +43,18 @@ module Redcarpet
43
43
  def header(text, header_level)
44
44
  text + "\n"
45
45
  end
46
+
47
+ def table(header, body)
48
+ "#{header}#{body}"
49
+ end
50
+
51
+ def table_row(content)
52
+ content + "\n"
53
+ end
54
+
55
+ def table_cell(content, alignment)
56
+ content + "\t"
57
+ end
46
58
  end
47
59
  end
48
60
  end
data/redcarpet.gemspec CHANGED
@@ -1,10 +1,10 @@
1
1
  # encoding: utf-8
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'tight-redcarpet'
4
- s.version = '3.2.0'
4
+ s.version = '3.3.2t'
5
5
  s.summary = "Markdown that smells nice (patch level 'tight')"
6
6
  s.description = 'A fast, safe and extensible Markdown to (X)HTML parser patched to have smaller headings and no quote-escaping'
7
- s.date = '2015-01-08'
7
+ s.date = '2015-09-24'
8
8
  s.email = 'ujifgc@github.com'
9
9
  s.homepage = 'http://github.com/ujifgc/redcarpet'
10
10
  s.authors = ["Natacha Porté", "Vicent Martí", "Igor Bochkariov"]
@@ -37,17 +37,20 @@ Gem::Specification.new do |s|
37
37
  ext/redcarpet/stack.c
38
38
  ext/redcarpet/stack.h
39
39
  lib/redcarpet.rb
40
+ lib/redcarpet/cli.rb
40
41
  lib/redcarpet/compat.rb
41
42
  lib/redcarpet/render_man.rb
42
43
  lib/redcarpet/render_strip.rb
43
44
  redcarpet.gemspec
44
45
  test/benchmark.rb
45
46
  test/custom_render_test.rb
47
+ test/fixtures/benchmark.md
46
48
  test/html5_test.rb
47
49
  test/html_render_test.rb
48
50
  test/html_toc_render_test.rb
49
51
  test/markdown_test.rb
50
52
  test/pathological_inputs_test.rb
53
+ test/redcarpet_bin_test.rb
51
54
  test/redcarpet_compat_test.rb
52
55
  test/safe_render_test.rb
53
56
  test/smarty_html_test.rb
@@ -62,7 +65,6 @@ Gem::Specification.new do |s|
62
65
  s.executables = ["redcarpet"]
63
66
  s.require_paths = ["lib"]
64
67
 
65
- s.add_development_dependency "nokogiri", "~> 1.6.3.1"
66
- s.add_development_dependency "rake-compiler", "~> 0.8.3"
67
- s.add_development_dependency "test-unit", "~> 2.5.4"
68
+ s.add_development_dependency "rake-compiler", "~> 0.9.5"
69
+ s.add_development_dependency "test-unit", "~> 3.1.3"
68
70
  end
@@ -10,7 +10,7 @@ class CustomRenderTest < Redcarpet::TestCase
10
10
 
11
11
  def test_simple_overload
12
12
  md = Redcarpet::Markdown.new(SimpleRender)
13
- html_equal "<p>This is <em class=\"cool\">just</em> a test</p>\n",
13
+ assert_equal "<p>This is <em class=\"cool\">just</em> a test</p>\n",
14
14
  md.render("This is *just* a test")
15
15
  end
16
16
 
@@ -0,0 +1,232 @@
1
+ Download
2
+ --------
3
+
4
+ [Markdown 1.0.1][dl] (18 KB) -- 17 Dec 2004
5
+
6
+ [dl]: http://daringfireball.net/projects/downloads/Markdown_1.0.1.zip
7
+
8
+
9
+ Introduction
10
+ ------------
11
+
12
+ Markdown is a text-to-HTML conversion tool for web writers. Markdown
13
+ allows you to write using an easy-to-read, easy-to-write plain text
14
+ format, then convert it to structurally valid XHTML (or HTML).
15
+
16
+ Thus, "Markdown" is two things: (1) a plain text formatting syntax;
17
+ and (2) a software tool, written in Perl, that converts the plain text
18
+ formatting to HTML. See the [Syntax][] page for details pertaining to
19
+ Markdown's formatting syntax. You can try it out, right now, using the
20
+ online [Dingus][].
21
+
22
+ [syntax]: /projects/markdown/syntax
23
+ [dingus]: /projects/markdown/dingus
24
+
25
+ The overriding design goal for Markdown's formatting syntax is to make
26
+ it as readable as possible. The idea is that a Markdown-formatted
27
+ document should be publishable as-is, as plain text, without looking
28
+ like it's been marked up with tags or formatting instructions. While
29
+ Markdown's syntax has been influenced by several existing text-to-HTML
30
+ filters, the single biggest source of inspiration for Markdown's
31
+ syntax is the format of plain text email.
32
+
33
+ The best way to get a feel for Markdown's formatting syntax is simply
34
+ to look at a Markdown-formatted document. For example, you can view
35
+ the Markdown source for the article text on this page here:
36
+ <http://daringfireball.net/projects/markdown/index.text>
37
+
38
+ (You can use this '.text' suffix trick to view the Markdown source for
39
+ the content of each of the pages in this section, e.g. the
40
+ [Syntax][s_src] and [License][l_src] pages.)
41
+
42
+ [s_src]: /projects/markdown/syntax.text
43
+ [l_src]: /projects/markdown/license.text
44
+
45
+ Markdown is free software, available under a BSD-style open source
46
+ license. See the [License] [pl] page for more information.
47
+
48
+ [pl]: /projects/markdown/license
49
+
50
+
51
+ Discussion List <a id="discussion-list" />
52
+ ---------------
53
+
54
+ I've set up a public [mailing list for discussion about Markdown] [ml].
55
+ Any topic related to Markdown -- both its formatting syntax and
56
+ its software -- is fair game for discussion. Anyone who is interested
57
+ is welcome to join.
58
+
59
+ It's my hope that the mailing list will lead to good ideas for future
60
+ improvements to Markdown.
61
+
62
+ [ml]: http://six.pairlist.net/mailman/listinfo/markdown-discuss
63
+
64
+
65
+ Installation and Requirements <a id="install" />
66
+ -----------------------------
67
+
68
+ Markdown requires Perl 5.6.0 or later. Welcome to the 21st Century.
69
+ Markdown also requires the standard Perl library module [Digest::MD5]
70
+ [md5], which is probably already installed on your server.
71
+
72
+ [md5]: http://search.cpan.org/dist/Digest-MD5/MD5.pm
73
+
74
+
75
+ ### Movable Type ###
76
+
77
+ Markdown works with Movable Type version 2.6 or later (including
78
+ Movable Type 3.0).
79
+
80
+ 1. Copy the "Markdown.pl" file into your Movable Type "plugins"
81
+ directory. The "plugins" directory should be in the same directory
82
+ as "mt.cgi"; if the "plugins" directory doesn't already exist, use
83
+ your FTP program to create it. Your installation should look like
84
+ this:
85
+
86
+ (mt home)/plugins/Markdown.pl
87
+
88
+ 2. Once installed, Markdown will appear as an option in Movable Type's
89
+ Text Formatting pop-up menu. This is selectable on a per-post basis:
90
+
91
+ ![Screenshot of Movable Type 'Text Formatting' Menu][tfmenu]
92
+
93
+ Markdown translates your posts to HTML when you publish; the posts
94
+ themselves are stored in your MT database in Markdown format.
95
+
96
+ 3. If you also install SmartyPants 1.5 (or later), Markdown will
97
+ offer a second text formatting option: "Markdown With
98
+ SmartyPants". This option is the same as the regular "Markdown"
99
+ formatter, except that it automatically uses SmartyPants to create
100
+ typographically correct curly quotes, em-dashes, and ellipses. See
101
+ the [SmartyPants web page][sp] for more information.
102
+
103
+ 4. To make Markdown (or "Markdown With SmartyPants") your default
104
+ text formatting option for new posts, go to Weblog Config:
105
+ Preferences.
106
+
107
+ Note that by default, Markdown produces XHTML output. To configure
108
+ Markdown to produce HTML 4 output, see "Configuration", below.
109
+
110
+ [sp]: http://daringfireball.net/projects/smartypants/
111
+
112
+
113
+
114
+ ### Blosxom ###
115
+
116
+ Markdown works with Blosxom version 2.0 or later.
117
+
118
+ 1. Rename the "Markdown.pl" plug-in to "Markdown" (case is
119
+ important). Movable Type requires plug-ins to have a ".pl"
120
+ extension; Blosxom forbids it.
121
+
122
+ 2. Copy the "Markdown" plug-in file to your Blosxom plug-ins folder.
123
+ If you're not sure where your Blosxom plug-ins folder is, see the
124
+ Blosxom documentation for information.
125
+
126
+ 3. That's it. The entries in your weblog will now automatically be
127
+ processed by Markdown.
128
+
129
+ 4. If you'd like to apply Markdown formatting only to certain
130
+ posts, rather than all of them, Markdown can optionally be used in
131
+ conjunction with Blosxom's [Meta][] plug-in. First, install the
132
+ Meta plug-in. Next, open the Markdown plug-in file in a text
133
+ editor, and set the configuration variable `$g_blosxom_use_meta`
134
+ to 1. Then, simply include a "`meta-markup: Markdown`" header line
135
+ at the top of each post you compose using Markdown.
136
+
137
+ [meta]: http://www.blosxom.com/plugins/meta/meta.htm
138
+
139
+
140
+ ### BBEdit ###
141
+
142
+ Markdown works with BBEdit 6.1 or later on Mac OS X. It also works
143
+ with BBEdit 5.1 or later and MacPerl 5.6.1 on Mac OS 8.6 or later. If
144
+ you're running Mac OS X 10.2 (Jaguar), you may need to install the
145
+ Perl module [Digest::MD5] [md5] from CPAN; Digest::MD5 comes
146
+ pre-installed on Mac OS X 10.3 (Panther).
147
+
148
+ 1. Copy the "Markdown.pl" file to appropriate filters folder in your
149
+ "BBEdit Support" folder. On Mac OS X, this should be:
150
+
151
+ BBEdit Support/Unix Support/Unix Filters/
152
+
153
+ See the BBEdit documentation for more details on the location of
154
+ these folders.
155
+
156
+ You can rename "Markdown.pl" to whatever you wish.
157
+
158
+ 2. That's it. To use Markdown, select some text in a BBEdit document,
159
+ then choose Markdown from the Filters sub-menu in the "#!" menu, or
160
+ the Filters floating palette
161
+
162
+
163
+
164
+ Configuration <a id="configuration"></a>
165
+ -------------
166
+
167
+ By default, Markdown produces XHTML output for tags with empty elements.
168
+ E.g.:
169
+
170
+ <br />
171
+
172
+ Markdown can be configured to produce HTML-style tags; e.g.:
173
+
174
+ <br>
175
+
176
+
177
+ ### Movable Type ###
178
+
179
+ You need to use a special `MTMarkdownOptions` container tag in each
180
+ Movable Type template where you want HTML 4-style output:
181
+
182
+ <MTMarkdownOptions output='html4'>
183
+ ... put your entry content here ...
184
+ </MTMarkdownOptions>
185
+
186
+ The easiest way to use MTMarkdownOptions is probably to put the
187
+ opening tag right after your `<body>` tag, and the closing tag right
188
+ before `</body>`.
189
+
190
+ To suppress Markdown processing in a particular template, i.e. to
191
+ publish the raw Markdown-formatted text without translation into
192
+ (X)HTML, set the `output` attribute to 'raw':
193
+
194
+ <MTMarkdownOptions output='raw'>
195
+ ... put your entry content here ...
196
+ </MTMarkdownOptions>
197
+
198
+
199
+ ### Command-Line ###
200
+
201
+ Use the `--html4tags` command-line switch to produce HTML output from a
202
+ Unix-style command line. E.g.:
203
+
204
+ % perl Markdown.pl --html4tags foo.text
205
+
206
+ Type `perldoc Markdown.pl`, or read the POD documentation within the
207
+ Markdown.pl source code for more information.
208
+
209
+
210
+ Acknowledgements <a id="acknowledgements" />
211
+ ----------------
212
+
213
+ [Aaron Swartz][] deserves a tremendous amount of credit for his feedback on the
214
+ design of Markdown's formatting syntax. Markdown is *much* better thanks
215
+ to Aaron's ideas, feedback, and testing. Also, Aaron's [html2text][]
216
+ is a very handy (and free) utility for turning HTML into
217
+ Markdown-formatted plain text.
218
+
219
+ [Nathaniel Irons][], [Dan Benjamin][], [Daniel Bogan][], and [Jason Perkins][]
220
+ also deserve thanks for their feedback.
221
+
222
+ [Michel Fortin][] has ported Markdown to PHP; it's a splendid port, and highly recommended for anyone looking for a PHP implementation of Markdown.
223
+
224
+ [Aaron Swartz]: http://www.aaronsw.com/
225
+ [Nathaniel Irons]: http://bumppo.net/
226
+ [Dan Benjamin]: http://hivelogic.com/
227
+ [Daniel Bogan]: http://waferbaby.com/
228
+ [Jason Perkins]: http://pressedpants.com/
229
+ [Michel Fortin]: http://www.michelf.com/projects/php-markdown/
230
+ [html2text]: http://www.aaronsw.com/2002/html2text/
231
+
232
+ [tfmenu]: /graphics/markdown/mt_textformat_menu.png
@@ -20,24 +20,24 @@ EOS
20
20
 
21
21
  <p>&lt;script&gt;BAD&lt;/script&gt;</p>
22
22
 
23
- <p>&lt;img src=&quot;/favicon.ico&quot; /&gt;</p>
23
+ <p>&lt;img src="/favicon.ico" /&gt;</p>
24
24
  EOE
25
25
 
26
- html_equal expected, render(source, with: [:escape_html])
26
+ assert_equal expected, render(source, with: [:escape_html])
27
27
  end
28
28
 
29
29
  def test_that_filter_html_works
30
30
  markdown = 'Through <em>NO</em> <script>DOUBLE NO</script>'
31
31
  output = render(markdown, with: [:filter_html])
32
32
 
33
- html_equal "<p>Through NO DOUBLE NO</p>\n", output
33
+ assert_equal "<p>Through NO DOUBLE NO</p>\n", output
34
34
  end
35
35
 
36
36
  def test_filter_html_doesnt_break_two_space_hard_break
37
37
  markdown = "Lorem, \nipsum\n"
38
38
  output = render(markdown, with: [:filter_html])
39
39
 
40
- html_equal "<p>Lorem,<br/>\nipsum</p>\n", output
40
+ assert_equal "<p>Lorem,<br>\nipsum</p>\n", output
41
41
  end
42
42
 
43
43
  def test_that_no_image_flag_works
@@ -58,7 +58,7 @@ EOE
58
58
  markdown = "[IRC](irc://chat.freenode.org/#freenode)"
59
59
  output = render(markdown, with: [:safe_links_only])
60
60
 
61
- html_equal "<p>[IRC](irc://chat.freenode.org/#freenode)</p>\n", output
61
+ assert_equal "<p>[IRC](irc://chat.freenode.org/#freenode)</p>\n", output
62
62
  end
63
63
 
64
64
  def test_that_hard_wrap_works
@@ -48,15 +48,14 @@ class HTMLTOCRenderTest < Redcarpet::TestCase
48
48
  titles = {
49
49
  "Donald E. Knuth" => "donald-e-knuth",
50
50
  "Random text with *(bad)* characters" => "random-text-with-bad-characters",
51
- "Trailing bad characters!@#" => "trailing-bad-characters",
52
- "!@#Leading bad characters" => "leading-bad-characters",
51
+ "!@#Surrounding bad characters!@#" => "surrounding-bad-characters",
53
52
  "Squeeze separators" => "squeeze-separators",
54
53
  "Test with + sign" => "test-with-sign",
55
54
  "Test with a Namespaced::Class" => "test-with-a-namespaced-class"
56
55
  }
57
56
 
58
57
  titles.each do |title, anchor|
59
- assert_match anchor, render("# #{title}")
58
+ assert_match %("##{anchor}"), render("# #{title}")
60
59
  end
61
60
  end
62
61
 
@@ -13,37 +13,37 @@ class MarkdownTest < Redcarpet::TestCase
13
13
 
14
14
  def test_that_simple_one_liner_goes_to_html
15
15
  assert_respond_to @markdown, :render
16
- html_equal "<p>Hello World.</p>\n", @markdown.render("Hello World.")
16
+ assert_equal "<p>Hello World.</p>\n", @markdown.render("Hello World.")
17
17
  end
18
18
 
19
19
  def test_that_inline_markdown_goes_to_html
20
20
  markdown = @markdown.render('_Hello World_!')
21
- html_equal "<p><em>Hello World</em>!</p>\n", markdown
21
+ assert_equal "<p><em>Hello World</em>!</p>\n", markdown
22
22
  end
23
23
 
24
24
  def test_that_inline_markdown_starts_and_ends_correctly
25
25
  markdown = render_with({:no_intra_emphasis => true}, '_start _ foo_bar bar_baz _ end_ *italic* **bold** <a>_blah_</a>')
26
26
 
27
- html_equal "<p><em>start _ foo_bar bar_baz _ end</em> <em>italic</em> <strong>bold</strong> <a><em>blah</em></a></p>\n", markdown
27
+ assert_equal "<p><em>start _ foo_bar bar_baz _ end</em> <em>italic</em> <strong>bold</strong> <a><em>blah</em></a></p>\n", markdown
28
28
 
29
29
  markdown = @markdown.render("Run 'rake radiant:extensions:rbac_base:migrate'")
30
- html_equal "<p>Run 'rake radiant:extensions:rbac_base:migrate'</p>\n", markdown
30
+ assert_equal "<p>Run 'rake radiant:extensions:rbac_base:migrate'</p>\n", markdown
31
31
  end
32
32
 
33
33
  def test_that_urls_are_not_doubly_escaped
34
34
  markdown = @markdown.render('[Page 2](/search?query=Markdown+Test&page=2)')
35
- html_equal "<p><a href=\"/search?query=Markdown+Test&amp;page=2\">Page 2</a></p>\n", markdown
35
+ assert_equal "<p><a href=\"/search?query=Markdown+Test&amp;page=2\">Page 2</a></p>\n", markdown
36
36
  end
37
37
 
38
38
  def test_simple_inline_html
39
39
  #markdown = Markdown.new("before\n\n<div>\n foo\n</div>\nafter")
40
40
  markdown = @markdown.render("before\n\n<div>\n foo\n</div>\n\nafter")
41
- html_equal "<p>before</p>\n\n<div>\n foo\n</div>\n\n<p>after</p>\n", markdown
41
+ assert_equal "<p>before</p>\n\n<div>\n foo\n</div>\n\n<p>after</p>\n", markdown
42
42
  end
43
43
 
44
44
  def test_that_html_blocks_do_not_require_their_own_end_tag_line
45
45
  markdown = @markdown.render("Para 1\n\n<div><pre>HTML block\n</pre></div>\n\nPara 2 [Link](#anchor)")
46
- html_equal "<p>Para 1</p>\n\n<div><pre>HTML block\n</pre></div>\n\n<p>Para 2 <a href=\"#anchor\">Link</a></p>\n",
46
+ assert_equal "<p>Para 1</p>\n\n<div><pre>HTML block\n</pre></div>\n\n<p>Para 2 <a href=\"#anchor\">Link</a></p>\n",
47
47
  markdown
48
48
  end
49
49
 
@@ -53,8 +53,8 @@ class MarkdownTest < Redcarpet::TestCase
53
53
  "A wise man once said:\n\n" +
54
54
  " > Isn't it wonderful just to be alive.\n"
55
55
  )
56
- html_equal "<p>A wise man once said:</p>\n\n" +
57
- "<blockquote><p>Isn't it wonderful just to be alive.</p>\n</blockquote>\n",
56
+ assert_equal "<p>A wise man once said:</p>\n\n" +
57
+ "<blockquote>\n<p>Isn't it wonderful just to be alive.</p>\n</blockquote>\n",
58
58
  markdown
59
59
  end
60
60
 
@@ -63,7 +63,7 @@ class MarkdownTest < Redcarpet::TestCase
63
63
  "Things to watch out for\n" +
64
64
  "<ul>\n<li>Blah</li>\n</ul>\n")
65
65
 
66
- html_equal "<p>Things to watch out for</p>\n\n" +
66
+ assert_equal "<p>Things to watch out for</p>\n\n" +
67
67
  "<ul>\n<li>Blah</li>\n</ul>\n", markdown
68
68
  end
69
69
 
@@ -85,7 +85,7 @@ MARKDOWN
85
85
 
86
86
  <p>This paragraph is not part of the list.</p>
87
87
  HTML
88
- html_equal expected, @markdown.render(text)
88
+ assert_equal expected, @markdown.render(text)
89
89
  end
90
90
 
91
91
  # http://github.com/rtomayko/rdiscount/issues/#issue/13
@@ -93,37 +93,37 @@ HTML
93
93
  text = "The Ant-Sugar Tales \n" +
94
94
  "=================== \n\n" +
95
95
  "By Candice Yellowflower \n"
96
- html_equal "<h3>The Ant-Sugar Tales </h3>\n\n<p>By Candice Yellowflower </p>\n", @markdown.render(text)
96
+ assert_equal "<h3>The Ant-Sugar Tales </h3>\n\n<p>By Candice Yellowflower </p>\n", @markdown.render(text)
97
97
  end
98
98
 
99
99
  def test_that_intra_emphasis_works
100
100
  rd = render_with({}, "foo_bar_baz")
101
- html_equal "<p>foo<em>bar</em>baz</p>\n", rd
101
+ assert_equal "<p>foo<em>bar</em>baz</p>\n", rd
102
102
 
103
103
  rd = render_with({:no_intra_emphasis => true},"foo_bar_baz")
104
- html_equal "<p>foo_bar_baz</p>\n", rd
104
+ assert_equal "<p>foo_bar_baz</p>\n", rd
105
105
  end
106
106
 
107
107
  def test_that_autolink_flag_works
108
108
  rd = render_with({:autolink => true}, "http://github.com/rtomayko/rdiscount")
109
- html_equal "<p><a href=\"http://github.com/rtomayko/rdiscount\">http://github.com/rtomayko/rdiscount</a></p>\n", rd
109
+ assert_equal "<p><a href=\"http://github.com/rtomayko/rdiscount\">http://github.com/rtomayko/rdiscount</a></p>\n", rd
110
110
  end
111
111
 
112
112
  def test_that_tags_can_have_dashes_and_underscores
113
113
  rd = @markdown.render("foo <asdf-qwerty>bar</asdf-qwerty> and <a_b>baz</a_b>")
114
- html_equal "<p>foo <asdf-qwerty>bar</asdf-qwerty> and <a_b>baz</a_b></p>\n", rd
114
+ assert_equal "<p>foo <asdf-qwerty>bar</asdf-qwerty> and <a_b>baz</a_b></p>\n", rd
115
115
  end
116
116
 
117
117
  def test_link_syntax_is_not_processed_within_code_blocks
118
118
  markdown = @markdown.render(" This is a code block\n This is a link [[1]] inside\n")
119
- html_equal "<pre><code>This is a code block\nThis is a link [[1]] inside\n</code></pre>\n",
119
+ assert_equal "<pre><code>This is a code block\nThis is a link [[1]] inside\n</code></pre>\n",
120
120
  markdown
121
121
  end
122
122
 
123
123
  def test_whitespace_after_urls
124
124
  rd = render_with({:autolink => true}, "Japan: http://www.abc.net.au/news/events/japan-quake-2011/beforeafter.htm (yes, japan)")
125
125
  exp = %{<p>Japan: <a href="http://www.abc.net.au/news/events/japan-quake-2011/beforeafter.htm">http://www.abc.net.au/news/events/japan-quake-2011/beforeafter.htm</a> (yes, japan)</p>\n}
126
- html_equal exp, rd
126
+ assert_equal exp, rd
127
127
  end
128
128
 
129
129
  def test_memory_leak_when_parsing_char_links
@@ -142,7 +142,7 @@ HTML
142
142
  end
143
143
 
144
144
  def test_infinite_loop_in_header
145
- html_equal "<h1>Body</h1>\n", @markdown.render(<<-header)
145
+ assert_equal "<h1>Body</h1>\n", @markdown.render(<<-header)
146
146
  ######
147
147
  #Body#
148
148
  ######
@@ -150,8 +150,8 @@ HTML
150
150
  end
151
151
 
152
152
  def test_a_hyphen_and_a_equal_should_not_be_converted_to_heading
153
- html_equal "<p>-</p>\n", @markdown.render("-")
154
- html_equal "<p>=</p>\n", @markdown.render("=")
153
+ assert_equal "<p>-</p>\n", @markdown.render("-")
154
+ assert_equal "<p>=</p>\n", @markdown.render("=")
155
155
  end
156
156
 
157
157
  def test_that_tables_flag_works
@@ -264,6 +264,18 @@ fenced
264
264
  assert out.include?("[1]: http://google.com")
265
265
  end
266
266
 
267
+ def test_that_fenced_code_copies_language_verbatim_with_braces
268
+ text = "```{rust,no_run}\nx = 'foo'\n```"
269
+ html = render_with({:fenced_code_blocks => true}, text)
270
+ assert_equal "<pre><code class=\"rust,no_run\">x = 'foo'\n</code></pre>\n", html
271
+ end
272
+
273
+ def test_that_fenced_code_copies_language_verbatim
274
+ text = "```rust,no_run\nx = 'foo'\n```"
275
+ html = render_with({:fenced_code_blocks => true}, text)
276
+ assert_equal "<pre><code class=\"rust,no_run\">x = 'foo'\n</code></pre>\n", html
277
+ end
278
+
267
279
  def test_that_indented_flag_works
268
280
  text = <<indented
269
281
  This is a simple text
@@ -280,14 +292,14 @@ indented
280
292
 
281
293
  def test_that_headers_are_linkable
282
294
  markdown = @markdown.render('### Hello [GitHub](http://github.com)')
283
- html_equal "<h3>Hello <a href=\"http://github.com\">GitHub</a></h3>\n", markdown
295
+ assert_equal "<h3>Hello <a href=\"http://github.com\">GitHub</a></h3>\n", markdown
284
296
  end
285
297
 
286
298
  def test_autolinking_with_ent_chars
287
299
  markdown = render_with({:autolink => true}, <<text)
288
300
  This a stupid link: https://github.com/rtomayko/tilt/issues?milestone=1&state=open
289
301
  text
290
- html_equal "<p>This a stupid link: <a href=\"https://github.com/rtomayko/tilt/issues?milestone=1&state=open\">https://github.com/rtomayko/tilt/issues?milestone=1&amp;state=open</a></p>\n", markdown
302
+ assert_equal "<p>This a stupid link: <a href=\"https://github.com/rtomayko/tilt/issues?milestone=1&amp;state=open\">https://github.com/rtomayko/tilt/issues?milestone=1&amp;state=open</a></p>\n", markdown
291
303
  end
292
304
 
293
305
  def test_spaced_headers
@@ -313,13 +325,13 @@ text
313
325
 
314
326
  def test_emphasis_escaping
315
327
  markdown = @markdown.render("**foo\\*** _dd\\_dd_")
316
- html_equal "<p><strong>foo*</strong> <em>dd_dd</em></p>\n", markdown
328
+ assert_equal "<p><strong>foo*</strong> <em>dd_dd</em></p>\n", markdown
317
329
  end
318
330
 
319
331
  def test_char_escaping_when_highlighting
320
332
  markdown = "==attribute\\==="
321
333
  output = render_with({highlight: true}, markdown)
322
- html_equal "<p><mark>attribute=</mark></p>\n", output
334
+ assert_equal "<p><mark>attribute=</mark></p>\n", output
323
335
  end
324
336
 
325
337
  def test_ordered_lists_with_lax_spacing
@@ -332,6 +344,28 @@ text
332
344
 
333
345
  def test_references_with_tabs_after_colon
334
346
  markdown = @markdown.render("[Link][id]\n[id]:\t\t\thttp://google.es")
335
- html_equal "<p><a href=\"http://google.es\">Link</a></p>\n", markdown
347
+ assert_equal "<p><a href=\"http://google.es\">Link</a></p>\n", markdown
348
+ end
349
+
350
+ def test_superscript
351
+ markdown = render_with({:superscript => true}, "this is the 2^nd time")
352
+ assert_equal "<p>this is the 2<sup>nd</sup> time</p>\n", markdown
353
+ end
354
+
355
+ def test_superscript_enclosed_in_parenthesis
356
+ markdown = render_with({:superscript => true}, "this is the 2^(nd) time")
357
+ assert_equal "<p>this is the 2<sup>nd</sup> time</p>\n", markdown
358
+ end
359
+
360
+ def test_no_rewind_into_previous_inline
361
+ result = "<p><em>!dl</em><a href=\"mailto:1@danlec.com\">1@danlec.com</a></p>\n"
362
+ output = render("_!dl_1@danlec.com", with: [:autolink])
363
+
364
+ assert_equal result, output
365
+
366
+ result = "<p>abc123<em><a href=\"http://www.foo.com\">www.foo.com</a></em>@foo.com</p>\n"
367
+ output = render("abc123_www.foo.com_@foo.com", with: [:autolink])
368
+
369
+ assert_equal result, output
336
370
  end
337
371
  end