discount 1.2.6
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.
- data/COPYING +52 -0
- data/README +17 -0
- data/Rakefile +126 -0
- data/ext/amalloc.h +29 -0
- data/ext/config.h +14 -0
- data/ext/cstring.h +68 -0
- data/ext/discount.c +48 -0
- data/ext/docheader.c +43 -0
- data/ext/dumptree.c +147 -0
- data/ext/extconf.rb +4 -0
- data/ext/generate.c +1319 -0
- data/ext/markdown.c +866 -0
- data/ext/markdown.h +125 -0
- data/ext/mkdio.c +223 -0
- data/ext/mkdio.h +58 -0
- data/ext/rbstrio.c +29 -0
- data/ext/rbstrio.h +5 -0
- data/ext/resource.c +167 -0
- data/lib/discount.rb +27 -0
- data/test.rb +76 -0
- data/test/MarkdownTest_1.0.3/MarkdownTest.pl +176 -0
- data/test/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html +17 -0
- data/test/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text +21 -0
- data/test/MarkdownTest_1.0.3/Tests/Auto links.html +18 -0
- data/test/MarkdownTest_1.0.3/Tests/Auto links.text +13 -0
- data/test/MarkdownTest_1.0.3/Tests/Backslash escapes.html +118 -0
- data/test/MarkdownTest_1.0.3/Tests/Backslash escapes.text +120 -0
- data/test/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html +15 -0
- data/test/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text +11 -0
- data/test/MarkdownTest_1.0.3/Tests/Code Blocks.html +18 -0
- data/test/MarkdownTest_1.0.3/Tests/Code Blocks.text +14 -0
- data/test/MarkdownTest_1.0.3/Tests/Code Spans.html +6 -0
- data/test/MarkdownTest_1.0.3/Tests/Code Spans.text +6 -0
- data/test/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html +8 -0
- data/test/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text +8 -0
- data/test/MarkdownTest_1.0.3/Tests/Horizontal rules.html +71 -0
- data/test/MarkdownTest_1.0.3/Tests/Horizontal rules.text +67 -0
- data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html +15 -0
- data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text +15 -0
- data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html +72 -0
- data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text +69 -0
- data/test/MarkdownTest_1.0.3/Tests/Inline HTML comments.html +13 -0
- data/test/MarkdownTest_1.0.3/Tests/Inline HTML comments.text +13 -0
- data/test/MarkdownTest_1.0.3/Tests/Links, inline style.html +11 -0
- data/test/MarkdownTest_1.0.3/Tests/Links, inline style.text +12 -0
- data/test/MarkdownTest_1.0.3/Tests/Links, reference style.html +52 -0
- data/test/MarkdownTest_1.0.3/Tests/Links, reference style.text +71 -0
- data/test/MarkdownTest_1.0.3/Tests/Links, shortcut references.html +9 -0
- data/test/MarkdownTest_1.0.3/Tests/Links, shortcut references.text +20 -0
- data/test/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html +3 -0
- data/test/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text +7 -0
- data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html +314 -0
- data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text +306 -0
- data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html +942 -0
- data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text +888 -0
- data/test/MarkdownTest_1.0.3/Tests/Nested blockquotes.html +9 -0
- data/test/MarkdownTest_1.0.3/Tests/Nested blockquotes.text +5 -0
- data/test/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html +148 -0
- data/test/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text +131 -0
- data/test/MarkdownTest_1.0.3/Tests/Strong and em together.html +7 -0
- data/test/MarkdownTest_1.0.3/Tests/Strong and em together.text +7 -0
- data/test/MarkdownTest_1.0.3/Tests/Tabs.html +25 -0
- data/test/MarkdownTest_1.0.3/Tests/Tabs.text +21 -0
- data/test/MarkdownTest_1.0.3/Tests/Tidyness.html +8 -0
- data/test/MarkdownTest_1.0.3/Tests/Tidyness.text +5 -0
- data/test/MarkdownTest_1.0/MarkdownTest.pl +157 -0
- data/test/MarkdownTest_1.0/Tests/Amps and angle encoding.html +17 -0
- data/test/MarkdownTest_1.0/Tests/Amps and angle encoding.text +21 -0
- data/test/MarkdownTest_1.0/Tests/Auto links.html +18 -0
- data/test/MarkdownTest_1.0/Tests/Auto links.text +13 -0
- data/test/MarkdownTest_1.0/Tests/Backslash escapes.html +102 -0
- data/test/MarkdownTest_1.0/Tests/Backslash escapes.text +104 -0
- data/test/MarkdownTest_1.0/Tests/Blockquotes with code blocks.html +15 -0
- data/test/MarkdownTest_1.0/Tests/Blockquotes with code blocks.text +11 -0
- data/test/MarkdownTest_1.0/Tests/Hard-wrapped paragraphs with list-like lines.html +8 -0
- data/test/MarkdownTest_1.0/Tests/Hard-wrapped paragraphs with list-like lines.text +8 -0
- data/test/MarkdownTest_1.0/Tests/Horizontal rules.html +71 -0
- data/test/MarkdownTest_1.0/Tests/Horizontal rules.text +67 -0
- data/test/MarkdownTest_1.0/Tests/Inline HTML (Advanced).html +14 -0
- data/test/MarkdownTest_1.0/Tests/Inline HTML (Advanced).text +14 -0
- data/test/MarkdownTest_1.0/Tests/Inline HTML (Simple).html +72 -0
- data/test/MarkdownTest_1.0/Tests/Inline HTML (Simple).text +69 -0
- data/test/MarkdownTest_1.0/Tests/Inline HTML comments.html +13 -0
- data/test/MarkdownTest_1.0/Tests/Inline HTML comments.text +13 -0
- data/test/MarkdownTest_1.0/Tests/Links, inline style.html +9 -0
- data/test/MarkdownTest_1.0/Tests/Links, inline style.text +9 -0
- data/test/MarkdownTest_1.0/Tests/Links, reference style.html +18 -0
- data/test/MarkdownTest_1.0/Tests/Links, reference style.text +31 -0
- data/test/MarkdownTest_1.0/Tests/Literal quotes in titles.html +3 -0
- data/test/MarkdownTest_1.0/Tests/Literal quotes in titles.text +7 -0
- data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Basics.html +314 -0
- data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Basics.text +306 -0
- data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Syntax.html +942 -0
- data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Syntax.text +888 -0
- data/test/MarkdownTest_1.0/Tests/Nested blockquotes.html +9 -0
- data/test/MarkdownTest_1.0/Tests/Nested blockquotes.text +5 -0
- data/test/MarkdownTest_1.0/Tests/Ordered and unordered lists.html +137 -0
- data/test/MarkdownTest_1.0/Tests/Ordered and unordered lists.text +122 -0
- data/test/MarkdownTest_1.0/Tests/Strong and em together.html +7 -0
- data/test/MarkdownTest_1.0/Tests/Strong and em together.text +7 -0
- data/test/MarkdownTest_1.0/Tests/Tabs.html +25 -0
- data/test/MarkdownTest_1.0/Tests/Tabs.text +21 -0
- data/test/MarkdownTest_1.0/Tests/Tidyness.html +8 -0
- data/test/MarkdownTest_1.0/Tests/Tidyness.text +5 -0
- metadata +160 -0
data/lib/discount.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
require 'discount.so'
|
|
2
|
+
|
|
3
|
+
class Discount
|
|
4
|
+
|
|
5
|
+
# Original Markdown formatted text.
|
|
6
|
+
attr_reader :text
|
|
7
|
+
|
|
8
|
+
# Set true to have smarty-like quote translation performed.
|
|
9
|
+
attr_accessor :smart
|
|
10
|
+
|
|
11
|
+
# BlueCloth compatible output filtering.
|
|
12
|
+
attr_accessor :filter_styles, :filter_html
|
|
13
|
+
|
|
14
|
+
# RedCloth compatible line folding -- not used for Markdown but
|
|
15
|
+
# included for compatibility.
|
|
16
|
+
attr_accessor :fold_lines
|
|
17
|
+
|
|
18
|
+
def initialize(text, *extensions)
|
|
19
|
+
@text = text
|
|
20
|
+
@smart = nil
|
|
21
|
+
@filter_styles = nil
|
|
22
|
+
@filter_html = nil
|
|
23
|
+
@fold_lines = nil
|
|
24
|
+
extensions.each { |e| send("#{e}=", true) }
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
end
|
data/test.rb
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
$: << File.join(File.dirname(__FILE__), "lib")
|
|
2
|
+
|
|
3
|
+
require 'test/unit'
|
|
4
|
+
require 'discount'
|
|
5
|
+
|
|
6
|
+
class DiscountTest < Test::Unit::TestCase
|
|
7
|
+
|
|
8
|
+
def test_that_extension_methods_are_present_on_discount_class
|
|
9
|
+
assert Discount.instance_methods.include?('to_html'),
|
|
10
|
+
"Discount class should respond to #to_html"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def test_that_simple_one_liner_goes_to_html
|
|
14
|
+
discount = Discount.new('Hello World.')
|
|
15
|
+
assert_respond_to discount, :to_html
|
|
16
|
+
assert_equal "<p>Hello World.</p>\n", discount.to_html
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_that_inline_markdown_goes_to_html
|
|
20
|
+
discount = Discount.new('_Hello World_!')
|
|
21
|
+
assert_respond_to discount, :to_html
|
|
22
|
+
assert_equal "<p><em>Hello World</em>!</p>\n", discount.to_html
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_that_bluecloth_restrictions_are_supported
|
|
26
|
+
discount = Discount.new('Hello World.')
|
|
27
|
+
[:filter_html, :filter_styles].each do |restriction|
|
|
28
|
+
assert_respond_to discount, restriction
|
|
29
|
+
assert_respond_to discount, "#{restriction}="
|
|
30
|
+
end
|
|
31
|
+
assert_not_equal true, discount.filter_html
|
|
32
|
+
assert_not_equal true, discount.filter_styles
|
|
33
|
+
|
|
34
|
+
discount = Discount.new('Hello World.', :filter_html, :filter_styles)
|
|
35
|
+
assert_equal true, discount.filter_html
|
|
36
|
+
assert_equal true, discount.filter_styles
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def test_that_redcloth_attributes_are_supported
|
|
40
|
+
discount = Discount.new('Hello World.')
|
|
41
|
+
assert_respond_to discount, :fold_lines
|
|
42
|
+
assert_respond_to discount, :fold_lines=
|
|
43
|
+
assert_not_equal true, discount.fold_lines
|
|
44
|
+
|
|
45
|
+
discount = Discount.new('Hello World.', :fold_lines)
|
|
46
|
+
assert_equal true, discount.fold_lines
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def test_that_redcloth_to_html_with_single_arg_is_supported
|
|
50
|
+
discount = Discount.new('Hello World.')
|
|
51
|
+
assert_nothing_raised(ArgumentError) { discount.to_html(true) }
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# Build tests for each file in the MarkdownTest test suite
|
|
55
|
+
|
|
56
|
+
Dir["#{File.dirname(__FILE__)}/test/MarkdownTest_1.0.3/Tests/*.text"].each do |text_file|
|
|
57
|
+
|
|
58
|
+
basename = File.basename(text_file).sub(/\.text$/, '')
|
|
59
|
+
html_file = text_file.sub(/text$/, 'html')
|
|
60
|
+
method_name = basename.gsub(/[-,]/, '').gsub(/\s+/, '_').downcase
|
|
61
|
+
|
|
62
|
+
define_method "test_#{method_name}" do
|
|
63
|
+
discount = Discount.new(File.read(text_file))
|
|
64
|
+
actual_html = discount.to_html
|
|
65
|
+
assert_not_nil actual_html
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
define_method "test_#{method_name}_with_smarty_enabled" do
|
|
69
|
+
discount = Discount.new(File.read(text_file), :smart)
|
|
70
|
+
actual_html = discount.to_html
|
|
71
|
+
assert_not_nil actual_html
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
end
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
#!/usr/bin/perl
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# MarkdownTester -- Run tests for Markdown implementations
|
|
5
|
+
#
|
|
6
|
+
# Copyright (c) 2004-2005 John Gruber
|
|
7
|
+
# <http://daringfireball.net/projects/markdown/>
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
use strict;
|
|
11
|
+
use warnings;
|
|
12
|
+
use Getopt::Long;
|
|
13
|
+
use Benchmark;
|
|
14
|
+
|
|
15
|
+
our $VERSION = '1.0.2';
|
|
16
|
+
# Sat 24 Dec 2005
|
|
17
|
+
|
|
18
|
+
my $time_start = new Benchmark;
|
|
19
|
+
my $test_dir = "Tests";
|
|
20
|
+
my $script = "./Markdown.pl";
|
|
21
|
+
my $use_tidy = 0;
|
|
22
|
+
my ($flag_version);
|
|
23
|
+
|
|
24
|
+
GetOptions (
|
|
25
|
+
"script=s" => \$script,
|
|
26
|
+
"testdir=s" => \$test_dir,
|
|
27
|
+
"tidy" => \$use_tidy,
|
|
28
|
+
"version" => \$flag_version,
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
if($flag_version) {
|
|
32
|
+
my $progname = $0;
|
|
33
|
+
$progname =~ s{.*/}{};
|
|
34
|
+
die "$progname version $VERSION\n";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
unless (-d $test_dir) { die "'$test_dir' is not a directory.\n"; }
|
|
38
|
+
unless (-f $script) { die "$script does not exist.\n"; }
|
|
39
|
+
unless (-x $script) { die "$script is not executable.\n"; }
|
|
40
|
+
|
|
41
|
+
my $tests_passed = 0;
|
|
42
|
+
my $tests_failed = 0;
|
|
43
|
+
|
|
44
|
+
TEST:
|
|
45
|
+
foreach my $testfile (glob "$test_dir/*.text") {
|
|
46
|
+
my $testname = $testfile;
|
|
47
|
+
$testname =~ s{.*/(.+)\.text$}{$1}i;
|
|
48
|
+
print "$testname ... ";
|
|
49
|
+
|
|
50
|
+
# Look for a corresponding .html file for each .text file:
|
|
51
|
+
my $resultfile = $testfile;
|
|
52
|
+
$resultfile =~ s{\.text$}{\.html}i;
|
|
53
|
+
unless (-f $resultfile) {
|
|
54
|
+
print "'$resultfile' does not exist.\n\n";
|
|
55
|
+
next TEST;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
# open(TEST, $testfile) || die("Can't open testfile: $!");
|
|
59
|
+
open(RESULT, $resultfile) || die("Can't open resultfile: $!");
|
|
60
|
+
undef $/;
|
|
61
|
+
# my $t_input = <TEST>;
|
|
62
|
+
my $t_result = <RESULT>;
|
|
63
|
+
|
|
64
|
+
my $t_output = `'$script' '$testfile'`;
|
|
65
|
+
|
|
66
|
+
# Normalize the output and expected result strings:
|
|
67
|
+
$t_result =~ s/\s+\z//; # trim trailing whitespace
|
|
68
|
+
$t_output =~ s/\s+\z//; # trim trailing whitespace
|
|
69
|
+
if ($use_tidy) {
|
|
70
|
+
# Escape the strings, pass them through to CLI tidy tool for tag-level equivalency
|
|
71
|
+
$t_result =~ s{'}{'\\''}g; # escape ' chars for shell
|
|
72
|
+
$t_output =~ s{'}{'\\''}g;
|
|
73
|
+
$t_result = `echo '$t_result' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
|
|
74
|
+
$t_output = `echo '$t_output' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if ($t_output eq $t_result) {
|
|
78
|
+
print "OK\n";
|
|
79
|
+
$tests_passed++;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
print "FAILED\n\n";
|
|
83
|
+
# This part added by JM to print diffs
|
|
84
|
+
open(OUT, '>tmp1') or die $!;
|
|
85
|
+
print OUT $t_output or die $!;
|
|
86
|
+
open(RES, '>tmp2') or die $!;
|
|
87
|
+
print RES $t_result or die $!;
|
|
88
|
+
print `diff tmp1 tmp2`;
|
|
89
|
+
close RES;
|
|
90
|
+
close OUT;
|
|
91
|
+
print "\n";
|
|
92
|
+
`rm tmp?`;
|
|
93
|
+
# End of added part
|
|
94
|
+
$tests_failed++;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
print "\n\n";
|
|
99
|
+
print "$tests_passed passed; $tests_failed failed.\n";
|
|
100
|
+
|
|
101
|
+
my $time_end = new Benchmark;
|
|
102
|
+
my $time_diff = timediff($time_end, $time_start);
|
|
103
|
+
print "Benchmark: ", timestr($time_diff), "\n";
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
__END__
|
|
107
|
+
|
|
108
|
+
=pod
|
|
109
|
+
|
|
110
|
+
=head1 NAME
|
|
111
|
+
|
|
112
|
+
B<MarkdownTest>
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
=head1 SYNOPSIS
|
|
116
|
+
|
|
117
|
+
B<MarkdownTest.pl> [ B<--options> ] [ I<file> ... ]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
=head1 DESCRIPTION
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
=head1 OPTIONS
|
|
124
|
+
|
|
125
|
+
Use "--" to end switch parsing. For example, to open a file named "-z", use:
|
|
126
|
+
|
|
127
|
+
MarkdownTest.pl -- -z
|
|
128
|
+
|
|
129
|
+
=over 4
|
|
130
|
+
|
|
131
|
+
=item B<--script>
|
|
132
|
+
|
|
133
|
+
Specify the path to the Markdown script to test. Defaults to
|
|
134
|
+
"./Markdown.pl". Example:
|
|
135
|
+
|
|
136
|
+
./MarkdownTest.pl --script ./PHP-Markdown/php-markdown
|
|
137
|
+
|
|
138
|
+
=item B<--testdir>
|
|
139
|
+
|
|
140
|
+
Specify the path to a directory containing test data. Defaults to "Tests".
|
|
141
|
+
|
|
142
|
+
=item B<--tidy>
|
|
143
|
+
|
|
144
|
+
Flag to turn on using the command line 'tidy' tool to normalize HTML
|
|
145
|
+
output before comparing script output to the expected test result.
|
|
146
|
+
Assumes that the 'tidy' command is available in your PATH. Defaults to
|
|
147
|
+
off.
|
|
148
|
+
|
|
149
|
+
=back
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
=head1 BUGS
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
=head1 VERSION HISTORY
|
|
158
|
+
|
|
159
|
+
1.0 Mon 13 Dec 2004-2005
|
|
160
|
+
|
|
161
|
+
1.0.1 Mon 19 Sep 2005
|
|
162
|
+
|
|
163
|
+
+ Better handling of case when foo.text exists, but foo.html doesn't.
|
|
164
|
+
It now prints a message and moves on, rather than dying.
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
=head1 COPYRIGHT AND LICENSE
|
|
168
|
+
|
|
169
|
+
Copyright (c) 2004-2005 John Gruber
|
|
170
|
+
<http://daringfireball.net/>
|
|
171
|
+
All rights reserved.
|
|
172
|
+
|
|
173
|
+
This is free software; you may redistribute it and/or modify it under
|
|
174
|
+
the same terms as Perl itself.
|
|
175
|
+
|
|
176
|
+
=cut
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<p>AT&T has an ampersand in their name.</p>
|
|
2
|
+
|
|
3
|
+
<p>AT&T is another way to write it.</p>
|
|
4
|
+
|
|
5
|
+
<p>This & that.</p>
|
|
6
|
+
|
|
7
|
+
<p>4 < 5.</p>
|
|
8
|
+
|
|
9
|
+
<p>6 > 5.</p>
|
|
10
|
+
|
|
11
|
+
<p>Here's a <a href="http://example.com/?foo=1&bar=2">link</a> with an ampersand in the URL.</p>
|
|
12
|
+
|
|
13
|
+
<p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&T">AT&T</a>.</p>
|
|
14
|
+
|
|
15
|
+
<p>Here's an inline <a href="/script?foo=1&bar=2">link</a>.</p>
|
|
16
|
+
|
|
17
|
+
<p>Here's an inline <a href="/script?foo=1&bar=2">link</a>.</p>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
AT&T has an ampersand in their name.
|
|
2
|
+
|
|
3
|
+
AT&T is another way to write it.
|
|
4
|
+
|
|
5
|
+
This & that.
|
|
6
|
+
|
|
7
|
+
4 < 5.
|
|
8
|
+
|
|
9
|
+
6 > 5.
|
|
10
|
+
|
|
11
|
+
Here's a [link] [1] with an ampersand in the URL.
|
|
12
|
+
|
|
13
|
+
Here's a link with an amersand in the link text: [AT&T] [2].
|
|
14
|
+
|
|
15
|
+
Here's an inline [link](/script?foo=1&bar=2).
|
|
16
|
+
|
|
17
|
+
Here's an inline [link](</script?foo=1&bar=2>).
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
[1]: http://example.com/?foo=1&bar=2
|
|
21
|
+
[2]: http://att.com/ "AT&T"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<p>Link: <a href="http://example.com/">http://example.com/</a>.</p>
|
|
2
|
+
|
|
3
|
+
<p>With an ampersand: <a href="http://example.com/?foo=1&bar=2">http://example.com/?foo=1&bar=2</a></p>
|
|
4
|
+
|
|
5
|
+
<ul>
|
|
6
|
+
<li>In a list?</li>
|
|
7
|
+
<li><a href="http://example.com/">http://example.com/</a></li>
|
|
8
|
+
<li>It should.</li>
|
|
9
|
+
</ul>
|
|
10
|
+
|
|
11
|
+
<blockquote>
|
|
12
|
+
<p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>
|
|
13
|
+
</blockquote>
|
|
14
|
+
|
|
15
|
+
<p>Auto-links should not occur here: <code><http://example.com/></code></p>
|
|
16
|
+
|
|
17
|
+
<pre><code>or here: <http://example.com/>
|
|
18
|
+
</code></pre>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Link: <http://example.com/>.
|
|
2
|
+
|
|
3
|
+
With an ampersand: <http://example.com/?foo=1&bar=2>
|
|
4
|
+
|
|
5
|
+
* In a list?
|
|
6
|
+
* <http://example.com/>
|
|
7
|
+
* It should.
|
|
8
|
+
|
|
9
|
+
> Blockquoted: <http://example.com/>
|
|
10
|
+
|
|
11
|
+
Auto-links should not occur here: `<http://example.com/>`
|
|
12
|
+
|
|
13
|
+
or here: <http://example.com/>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<p>These should all get escaped:</p>
|
|
2
|
+
|
|
3
|
+
<p>Backslash: \</p>
|
|
4
|
+
|
|
5
|
+
<p>Backtick: `</p>
|
|
6
|
+
|
|
7
|
+
<p>Asterisk: *</p>
|
|
8
|
+
|
|
9
|
+
<p>Underscore: _</p>
|
|
10
|
+
|
|
11
|
+
<p>Left brace: {</p>
|
|
12
|
+
|
|
13
|
+
<p>Right brace: }</p>
|
|
14
|
+
|
|
15
|
+
<p>Left bracket: [</p>
|
|
16
|
+
|
|
17
|
+
<p>Right bracket: ]</p>
|
|
18
|
+
|
|
19
|
+
<p>Left paren: (</p>
|
|
20
|
+
|
|
21
|
+
<p>Right paren: )</p>
|
|
22
|
+
|
|
23
|
+
<p>Greater-than: ></p>
|
|
24
|
+
|
|
25
|
+
<p>Hash: #</p>
|
|
26
|
+
|
|
27
|
+
<p>Period: .</p>
|
|
28
|
+
|
|
29
|
+
<p>Bang: !</p>
|
|
30
|
+
|
|
31
|
+
<p>Plus: +</p>
|
|
32
|
+
|
|
33
|
+
<p>Minus: -</p>
|
|
34
|
+
|
|
35
|
+
<p>These should not, because they occur within a code block:</p>
|
|
36
|
+
|
|
37
|
+
<pre><code>Backslash: \\
|
|
38
|
+
|
|
39
|
+
Backtick: \`
|
|
40
|
+
|
|
41
|
+
Asterisk: \*
|
|
42
|
+
|
|
43
|
+
Underscore: \_
|
|
44
|
+
|
|
45
|
+
Left brace: \{
|
|
46
|
+
|
|
47
|
+
Right brace: \}
|
|
48
|
+
|
|
49
|
+
Left bracket: \[
|
|
50
|
+
|
|
51
|
+
Right bracket: \]
|
|
52
|
+
|
|
53
|
+
Left paren: \(
|
|
54
|
+
|
|
55
|
+
Right paren: \)
|
|
56
|
+
|
|
57
|
+
Greater-than: \>
|
|
58
|
+
|
|
59
|
+
Hash: \#
|
|
60
|
+
|
|
61
|
+
Period: \.
|
|
62
|
+
|
|
63
|
+
Bang: \!
|
|
64
|
+
|
|
65
|
+
Plus: \+
|
|
66
|
+
|
|
67
|
+
Minus: \-
|
|
68
|
+
</code></pre>
|
|
69
|
+
|
|
70
|
+
<p>Nor should these, which occur in code spans:</p>
|
|
71
|
+
|
|
72
|
+
<p>Backslash: <code>\\</code></p>
|
|
73
|
+
|
|
74
|
+
<p>Backtick: <code>\`</code></p>
|
|
75
|
+
|
|
76
|
+
<p>Asterisk: <code>\*</code></p>
|
|
77
|
+
|
|
78
|
+
<p>Underscore: <code>\_</code></p>
|
|
79
|
+
|
|
80
|
+
<p>Left brace: <code>\{</code></p>
|
|
81
|
+
|
|
82
|
+
<p>Right brace: <code>\}</code></p>
|
|
83
|
+
|
|
84
|
+
<p>Left bracket: <code>\[</code></p>
|
|
85
|
+
|
|
86
|
+
<p>Right bracket: <code>\]</code></p>
|
|
87
|
+
|
|
88
|
+
<p>Left paren: <code>\(</code></p>
|
|
89
|
+
|
|
90
|
+
<p>Right paren: <code>\)</code></p>
|
|
91
|
+
|
|
92
|
+
<p>Greater-than: <code>\></code></p>
|
|
93
|
+
|
|
94
|
+
<p>Hash: <code>\#</code></p>
|
|
95
|
+
|
|
96
|
+
<p>Period: <code>\.</code></p>
|
|
97
|
+
|
|
98
|
+
<p>Bang: <code>\!</code></p>
|
|
99
|
+
|
|
100
|
+
<p>Plus: <code>\+</code></p>
|
|
101
|
+
|
|
102
|
+
<p>Minus: <code>\-</code></p>
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
<p>These should get escaped, even though they're matching pairs for
|
|
106
|
+
other Markdown constructs:</p>
|
|
107
|
+
|
|
108
|
+
<p>*asterisks*</p>
|
|
109
|
+
|
|
110
|
+
<p>_underscores_</p>
|
|
111
|
+
|
|
112
|
+
<p>`backticks`</p>
|
|
113
|
+
|
|
114
|
+
<p>This is a code span with a literal backslash-backtick sequence: <code>\`</code></p>
|
|
115
|
+
|
|
116
|
+
<p>This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.</p>
|
|
117
|
+
|
|
118
|
+
<p>This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.</p>
|