diff --git a/Parsedown.php b/Parsedown.php index f877c4871..75ba01464 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -66,6 +66,24 @@ function setBreaksEnabled($breaksEnabled) return $this; } + private $escapingEnabled; + + function setHtmlEscaping($escapingEnabled) + { + $this->escapingEnabled = $escapingEnabled; + + return $this; + } + + private $safeLinksEnabled; + + function setSafeLinks($safeLinksEnabled) + { + $this->safeLinksEnabled = $safeLinksEnabled; + + return $this; + } + # # Lines # @@ -92,7 +110,7 @@ function setBreaksEnabled($breaksEnabled) '_' => array('Rule'), '`' => array('FencedCode'), '|' => array('Table'), - '~' => array('FencedCode'), + '~' => array('FencedCode') ); # ~ @@ -350,6 +368,11 @@ protected function completeCodeBlock($Block) protected function identifyComment($Line) { + if ($this->escapingEnabled) + { + return; + } + if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!') { $Block = array( @@ -367,7 +390,7 @@ protected function identifyComment($Line) protected function addToComment($Line, array $Block) { - if (isset($Block['closed'])) + if (isset($Block['closed']) || $this->escapingEnabled) { return; } @@ -619,6 +642,11 @@ protected function identifySetext($Line, array $Block = null) protected function identifyMarkup($Line) { + if ($this->escapingEnabled) + { + return; + } + if (preg_match('/^<(\w[\w\d]*)(?:[ ][^>\/]*)?(\/?)[ ]*>/', $Line['text'], $matches)) { if (in_array($matches[1], $this->textLevelElements)) @@ -646,7 +674,7 @@ protected function identifyMarkup($Line) protected function addToMarkup($Line, array $Block) { - if (isset($Block['closed'])) + if (isset($Block['closed']) || $this->escapingEnabled) { return; } @@ -946,16 +974,17 @@ protected function elements(array $Elements) '*' => array('Emphasis'), '/' => array('Url'), '<' => array('UrlTag', 'EmailTag', 'Tag', 'LessThan'), + '>' => array('GreaterThan'), '[' => array('Link'), '_' => array('Emphasis'), '`' => array('InlineCode'), '~' => array('Strikethrough'), - '\\' => array('EscapeSequence'), + '\\' => array('EscapeSequence') ); # ~ - protected $spanMarkerList = '*_!&[`~\\'; + protected $spanMarkerList = '*_!&[<>/`~\\'; # # ~ @@ -1040,7 +1069,7 @@ protected function identifyUrl($Excerpt) if (preg_match('/\bhttps?:[\/]{2}[^\s<]+\b\/*/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)) { - $url = str_replace(array('&', '<'), array('&', '<'), $matches[0][0]); + $url = str_replace(array('&', '<', '>'), array('&', '<', '>'), $matches[0][0]); return array( 'extent' => strlen($matches[0][0]), @@ -1091,10 +1120,20 @@ protected function identifyEscapeSequence($Excerpt) { if (isset($Excerpt['text'][1]) and in_array($Excerpt['text'][1], $this->specialCharacters)) { - return array( - 'markup' => $Excerpt['text'][1], - 'extent' => 2, - ); + if ($this->escapingEnabled && $Excerpt['text'][1] == '>') + { + return array( + 'markup' => '>', + 'extent' => 2, + ); + } + else + { + return array( + 'markup' => $Excerpt['text'][1], + 'extent' => 2, + ); + } } } @@ -1106,11 +1145,19 @@ protected function identifyLessThan() ); } + protected function identifyGreaterThan() + { + return array( + 'markup' => '>', + 'extent' => 1, + ); + } + protected function identifyUrlTag($Excerpt) { if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<(https?:[\/]{2}[^\s]+?)>/i', $Excerpt['text'], $matches)) { - $url = str_replace(array('&', '<'), array('&', '<'), $matches[1]); + $url = str_replace(array('&', '<', '>'), array('&', '<', '>'), $matches[1]); return array( 'extent' => strlen($matches[0]), @@ -1144,6 +1191,11 @@ protected function identifyEmailTag($Excerpt) protected function identifyTag($Excerpt) { + if ($this->escapingEnabled) + { + return; + } + if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<\/?\w.*?>/', $Excerpt['text'], $matches)) { return array( @@ -1229,7 +1281,12 @@ protected function identifyLink($Excerpt) return; } - $url = str_replace(array('&', '<'), array('&', '<'), $Link['url']); + if ($this->safeLinksEnabled && stripos($Link['url'], 'javascript:') !== false) + { + return; + } + + $url = str_replace(array('&', '<', '>'), array('&', '<', '>'), $Link['url']); if ($Excerpt['text'][0] === '!') { diff --git a/test/Test.php b/test/Test.php index 5171d846f..ba4cd4365 100644 --- a/test/Test.php +++ b/test/Test.php @@ -23,7 +23,14 @@ function test_($filename) $expectedMarkup = str_replace("\r\n", "\n", $expectedMarkup); $expectedMarkup = str_replace("\r", "\n", $expectedMarkup); - $actualMarkup = Parsedown::instance()->text($markdown); + if (strpos($filename, '_escaped') !== false) + { + $actualMarkup = Parsedown::instance('escaped')->setHtmlEscaping(true)->text($markdown); + } + else + { + $actualMarkup = Parsedown::instance()->text($markdown); + } $this->assertEquals($expectedMarkup, $actualMarkup); } diff --git a/test/data/HTML_Comment_escaped.html b/test/data/HTML_Comment_escaped.html new file mode 100644 index 000000000..1e24c1712 --- /dev/null +++ b/test/data/HTML_Comment_escaped.html @@ -0,0 +1,5 @@ +
<!-- single line -->
+paragraph
+<!-- +multiline -->
+paragraph
\ No newline at end of file diff --git a/test/data/HTML_Comment_escaped.md b/test/data/HTML_Comment_escaped.md new file mode 100644 index 000000000..6ddfdb441 --- /dev/null +++ b/test/data/HTML_Comment_escaped.md @@ -0,0 +1,8 @@ + + +paragraph + + + +paragraph \ No newline at end of file diff --git a/test/data/aesthetic_table_escaped.html b/test/data/aesthetic_table_escaped.html new file mode 100644 index 000000000..88e1c2bd4 --- /dev/null +++ b/test/data/aesthetic_table_escaped.html @@ -0,0 +1,18 @@ +header 1 | +header 2 | +
---|---|
cell 1.1 | +cell 1.2 | +
cell 2.1 | +cell 2.2 | +
header 1 | +header 2 | +header 2 | +
---|---|---|
cell 1.1 | +cell 1.2 | +cell 1.3 | +
cell 2.1 | +cell 2.2 | +cell 2.3 | +
#
\ No newline at end of file diff --git a/test/data/atx_heading_escaped.md b/test/data/atx_heading_escaped.md new file mode 100644 index 000000000..039baaa90 --- /dev/null +++ b/test/data/atx_heading_escaped.md @@ -0,0 +1,15 @@ +# h1 + +## h2 + +### h3 + +#### h4 + +##### h5 + +###### h6 + +# closed h1 # + +# \ No newline at end of file diff --git a/test/data/automatic_link_escaped.html b/test/data/automatic_link_escaped.html new file mode 100644 index 000000000..50a94ba0f --- /dev/null +++ b/test/data/automatic_link_escaped.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/data/automatic_link_escaped.md b/test/data/automatic_link_escaped.md new file mode 100644 index 000000000..08d3bf46a --- /dev/null +++ b/test/data/automatic_link_escaped.md @@ -0,0 +1 @@ +<div>content</div>
+sparse:
+<div> +<div class="inner"> +content +</div> +</div>
+paragraph
\ No newline at end of file diff --git a/test/data/block-level_html_escaped.md b/test/data/block-level_html_escaped.md new file mode 100644 index 000000000..943e183c3 --- /dev/null +++ b/test/data/block-level_html_escaped.md @@ -0,0 +1,11 @@ +<?php
+
+$message = 'Hello World!';
+echo $message;
+> not a quote
+- not a list item
+[not a reference]: http://foo.com
\ No newline at end of file
diff --git a/test/data/code_block_escaped.md b/test/data/code_block_escaped.md
new file mode 100644
index 000000000..2cfc953cc
--- /dev/null
+++ b/test/data/code_block_escaped.md
@@ -0,0 +1,10 @@
+ not a quote
+ - not a list item
+ [not a reference]: http://foo.com
\ No newline at end of file
diff --git a/test/data/code_span_escaped.html b/test/data/code_span_escaped.html
new file mode 100644
index 000000000..5c4c231e3
--- /dev/null
+++ b/test/data/code_span_escaped.html
@@ -0,0 +1,6 @@
+a code span
this is also a codespan
trailing text
and look at this one!
single backtick in a code span: `
backtick-delimited string in a code span: `foo`
sth `` sth
+\ No newline at end of file diff --git a/test/data/compound_blockquote_escaped.md b/test/data/compound_blockquote_escaped.md new file mode 100644 index 000000000..80c4aed16 --- /dev/null +++ b/test/data/compound_blockquote_escaped.md @@ -0,0 +1,10 @@ +> header +> ------ +> +> paragraph +> +> - li +> +> --- +> +> paragraph \ No newline at end of file diff --git a/test/data/compound_emphasis_escaped.html b/test/data/compound_emphasis_escaped.html new file mode 100644 index 000000000..178dd54ba --- /dev/null +++ b/test/data/compound_emphasis_escaped.html @@ -0,0 +1,2 @@ +header
+paragraph
++
+- li
+
+paragraph
+
code
code
code
code
code
paragraph
+paragraph
+paragraph
+++quote
+
em strong
+em strong strong
+strong em strong
+strong em strong strong
+em strong
+em strong strong
+strong em strong
+strong em strong strong
\ No newline at end of file diff --git a/test/data/em_strong_escaped.md b/test/data/em_strong_escaped.md new file mode 100644 index 000000000..9abeb3fd4 --- /dev/null +++ b/test/data/em_strong_escaped.md @@ -0,0 +1,15 @@ +___em strong___ + +___em strong_ strong__ + +__strong _em strong___ + +__strong _em strong_ strong__ + +***em strong*** + +***em strong* strong** + +**strong *em strong*** + +**strong *em strong* strong** \ No newline at end of file diff --git a/test/data/email_escaped.html b/test/data/email_escaped.html new file mode 100644 index 000000000..c40759c96 --- /dev/null +++ b/test/data/email_escaped.html @@ -0,0 +1 @@ +my email is me@example.com
\ No newline at end of file diff --git a/test/data/email_escaped.md b/test/data/email_escaped.md new file mode 100644 index 000000000..26b7b6cc5 --- /dev/null +++ b/test/data/email_escaped.md @@ -0,0 +1 @@ +my email isunderscore, asterisk, one two, three four, a, b
+strong and em and strong and em
+line +line +line
+this_is_not_an_emphasis
+an empty emphasis __ ** is not an emphasis
+*mixed *double and single asterisk** spans
\ No newline at end of file diff --git a/test/data/emphasis_escaped.md b/test/data/emphasis_escaped.md new file mode 100644 index 000000000..85b9d2299 --- /dev/null +++ b/test/data/emphasis_escaped.md @@ -0,0 +1,13 @@ +_underscore_, *asterisk*, _one two_, *three four*, _a_, *b* + +**strong** and *em* and **strong** and *em* + +_line +line +line_ + +this_is_not_an_emphasis + +an empty emphasis __ ** is not an emphasis + +*mixed **double and* single asterisk** spans \ No newline at end of file diff --git a/test/data/escaping_escaped.html b/test/data/escaping_escaped.html new file mode 100644 index 000000000..c73b30970 --- /dev/null +++ b/test/data/escaping_escaped.html @@ -0,0 +1,4 @@ +escaped *emphasis*.
+escaped \*emphasis\* in a code span
escaped \*emphasis\* in a code block
+\ ` * _ { } [ ] ( ) > # + - . !
\ No newline at end of file diff --git a/test/data/escaping_escaped.md b/test/data/escaping_escaped.md new file mode 100644 index 000000000..164039f80 --- /dev/null +++ b/test/data/escaping_escaped.md @@ -0,0 +1,7 @@ +escaped \*emphasis\*. + +`escaped \*emphasis\* in a code span` + + escaped \*emphasis\* in a code block + +\\ \` \* \_ \{ \} \[ \] \( \) \> \# \+ \- \. \! \ No newline at end of file diff --git a/test/data/fenced_code_block_escaped.html b/test/data/fenced_code_block_escaped.html new file mode 100644 index 000000000..8bdabba96 --- /dev/null +++ b/test/data/fenced_code_block_escaped.html @@ -0,0 +1,6 @@ +<?php
+
+$message = 'fenced code block';
+echo $message;
+tilde
+echo 'language identifier';
\ No newline at end of file
diff --git a/test/data/fenced_code_block_escaped.md b/test/data/fenced_code_block_escaped.md
new file mode 100644
index 000000000..cbed8ebb5
--- /dev/null
+++ b/test/data/fenced_code_block_escaped.md
@@ -0,0 +1,14 @@
+```
+
+& © {
\ No newline at end of file diff --git a/test/data/html_entity_escaped.md b/test/data/html_entity_escaped.md new file mode 100644 index 000000000..ff545ea5c --- /dev/null +++ b/test/data/html_entity_escaped.md @@ -0,0 +1 @@ +& © { \ No newline at end of file diff --git a/test/data/image_reference_escaped.html b/test/data/image_reference_escaped.html new file mode 100644 index 000000000..b3249cba2 --- /dev/null +++ b/test/data/image_reference_escaped.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/data/image_reference_escaped.md b/test/data/image_reference_escaped.md new file mode 100644 index 000000000..dcb1414dd --- /dev/null +++ b/test/data/image_reference_escaped.md @@ -0,0 +1,3 @@ +![Markdown Logo][image] + +[image]: /md.png diff --git a/test/data/image_title_escaped.html b/test/data/image_title_escaped.html new file mode 100644 index 000000000..82c155f61 --- /dev/null +++ b/test/data/image_title_escaped.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/data/image_title_escaped.md b/test/data/image_title_escaped.md new file mode 100644 index 000000000..3e58ee555 --- /dev/null +++ b/test/data/image_title_escaped.md @@ -0,0 +1 @@ +![alt](/md.png "title") \ No newline at end of file diff --git a/test/data/implicit_reference_escaped.html b/test/data/implicit_reference_escaped.html new file mode 100644 index 000000000..24b51c1b0 --- /dev/null +++ b/test/data/implicit_reference_escaped.html @@ -0,0 +1,4 @@ +an implicit reference link
+an implicit reference link with an empty link definition
+an implicit reference link followed by another
+an explicit reference link with a title
\ No newline at end of file diff --git a/test/data/implicit_reference_escaped.md b/test/data/implicit_reference_escaped.md new file mode 100644 index 000000000..f850df964 --- /dev/null +++ b/test/data/implicit_reference_escaped.md @@ -0,0 +1,13 @@ +an [implicit] reference link + +[implicit]: http://example.com + +an [implicit][] reference link with an empty link definition + +an [implicit][] reference link followed by [another][] + +[another]: http://cnn.com + +an [explicit][example] reference link with a title + +[example]: http://example.com "Example" \ No newline at end of file diff --git a/test/data/inline_link_escaped.html b/test/data/inline_link_escaped.html new file mode 100644 index 000000000..2b9e649d6 --- /dev/null +++ b/test/data/inline_link_escaped.html @@ -0,0 +1,4 @@ +link and another link
+ + + \ No newline at end of file diff --git a/test/data/inline_link_escaped.md b/test/data/inline_link_escaped.md new file mode 100644 index 000000000..cd8e5a63f --- /dev/null +++ b/test/data/inline_link_escaped.md @@ -0,0 +1,7 @@ +[link](http://example.com) and [another link](/tests/) + +[`link`](http://example.com) + +[![MD Logo](http://parsedown.org/md.png)](http://example.com) + +[![MD Logo](http://parsedown.org/md.png) and text](http://example.com) \ No newline at end of file diff --git a/test/data/inline_link_title_escaped.html b/test/data/inline_link_title_escaped.html new file mode 100644 index 000000000..70e589aa8 --- /dev/null +++ b/test/data/inline_link_title_escaped.html @@ -0,0 +1 @@ +single quotes and double quotes
\ No newline at end of file diff --git a/test/data/inline_link_title_escaped.md b/test/data/inline_link_title_escaped.md new file mode 100644 index 000000000..162b832ac --- /dev/null +++ b/test/data/inline_link_title_escaped.md @@ -0,0 +1 @@ +[single quotes](http://example.com 'Title') and [double quotes](http://example.com "Title") \ No newline at end of file diff --git a/test/data/inline_title_escaped.html b/test/data/inline_title_escaped.html new file mode 100644 index 000000000..bbab93b6c --- /dev/null +++ b/test/data/inline_title_escaped.html @@ -0,0 +1 @@ +single quotes and double quotes
\ No newline at end of file diff --git a/test/data/inline_title_escaped.md b/test/data/inline_title_escaped.md new file mode 100644 index 000000000..cb09344a1 --- /dev/null +++ b/test/data/inline_title_escaped.md @@ -0,0 +1 @@ +[single quotes](http://example.com 'Example') and [double quotes](http://example.com "Example") \ No newline at end of file diff --git a/test/data/lazy_blockquote_escaped.html b/test/data/lazy_blockquote_escaped.html new file mode 100644 index 000000000..0a2a2aaf9 --- /dev/null +++ b/test/data/lazy_blockquote_escaped.html @@ -0,0 +1,6 @@ ++\ No newline at end of file diff --git a/test/data/lazy_blockquote_escaped.md b/test/data/lazy_blockquote_escaped.md new file mode 100644 index 000000000..48f645f94 --- /dev/null +++ b/test/data/lazy_blockquote_escaped.md @@ -0,0 +1,5 @@ +> quote +the rest of it + +> another paragraph +the rest of it \ No newline at end of file diff --git a/test/data/lazy_list_escaped.html b/test/data/lazy_list_escaped.html new file mode 100644 index 000000000..1a5199249 --- /dev/null +++ b/test/data/lazy_list_escaped.html @@ -0,0 +1,4 @@ +quote +the rest of it
+another paragraph +the rest of it
+
line
+line
li
+line +line
+<div> +parent +<div> +child +</div> +<pre> +adopted child +</pre> +</div>
+outside
\ No newline at end of file diff --git a/test/data/nested_block-level_html_escaped.md b/test/data/nested_block-level_html_escaped.md new file mode 100644 index 000000000..5e01e1097 --- /dev/null +++ b/test/data/nested_block-level_html_escaped.md @@ -0,0 +1,11 @@ ++_adopted child_ ++
repeating numbers:
+large numbers:
+paragraph
+paragraph
+li
+double quotes and single quotes and parentheses
+[invalid title]: http://example.com example title
\ No newline at end of file diff --git a/test/data/reference_title_escaped.md b/test/data/reference_title_escaped.md new file mode 100644 index 000000000..43cb21708 --- /dev/null +++ b/test/data/reference_title_escaped.md @@ -0,0 +1,6 @@ +[double quotes] and [single quotes] and [parentheses] + +[double quotes]: http://example.com "example title" +[single quotes]: http://example.com 'example title' +[parentheses]: http://example.com (example title) +[invalid title]: http://example.com example title \ No newline at end of file diff --git a/test/data/self-closing_html_escaped.html b/test/data/self-closing_html_escaped.html new file mode 100644 index 000000000..df415ebb9 --- /dev/null +++ b/test/data/self-closing_html_escaped.html @@ -0,0 +1,12 @@ +<hr> +paragraph +<hr/> +paragraph +<hr /> +paragraph +<hr class="foo" id="bar" /> +paragraph +<hr class="foo" id="bar"/> +paragraph +<hr class="foo" id="bar" > +paragraph
\ No newline at end of file diff --git a/test/data/self-closing_html_escaped.md b/test/data/self-closing_html_escaped.md new file mode 100644 index 000000000..acb20327d --- /dev/null +++ b/test/data/self-closing_html_escaped.md @@ -0,0 +1,12 @@ +li
+not a header
+++quote
+
indented:
+++quote
+
no space after >
:
+\ No newline at end of file diff --git a/test/data/simple_blockquote_escaped.md b/test/data/simple_blockquote_escaped.md new file mode 100644 index 000000000..22b6b11a9 --- /dev/null +++ b/test/data/simple_blockquote_escaped.md @@ -0,0 +1,7 @@ +> quote + +indented: + > quote + +no space after `>`: +>quote \ No newline at end of file diff --git a/test/data/simple_table_escaped.html b/test/data/simple_table_escaped.html new file mode 100644 index 000000000..64b7a9a23 --- /dev/null +++ b/test/data/simple_table_escaped.html @@ -0,0 +1,37 @@ +quote
+
header 1 | +header 2 | +
---|---|
cell 1.1 | +cell 1.2 | +
cell 2.1 | +cell 2.2 | +
header 1 | +header 2 | +
---|---|
cell 1.1 | +cell 1.2 | +
cell 2.1 | +cell 2.2 | +
an <b>important</b> <a href=''>link</a>
+broken<br/> +line
+<b>inline tag</b> at the beginning
+<span>http://example.com</span>
\ No newline at end of file diff --git a/test/data/span-level_html_escaped.md b/test/data/span-level_html_escaped.md new file mode 100644 index 000000000..f22196555 --- /dev/null +++ b/test/data/span-level_html_escaped.md @@ -0,0 +1,8 @@ +an important link + +brokenli
+li
+li
+AT&T has an ampersand in their name
this & that
-4 < 5 and 6 > 5
+4 < 5 and 6 > 5
http://example.com/autolink?a=1&b=2
\ No newline at end of file diff --git a/test/data/special_characters_escaped.html b/test/data/special_characters_escaped.html new file mode 100644 index 000000000..3b652c338 --- /dev/null +++ b/test/data/special_characters_escaped.html @@ -0,0 +1,6 @@ +AT&T has an ampersand in their name
+this & that
+4 < 5 and 6 > 5
+http://example.com/autolink?a=1&b=2
+ + \ No newline at end of file diff --git a/test/data/special_characters_escaped.md b/test/data/special_characters_escaped.md new file mode 100644 index 000000000..111b03b63 --- /dev/null +++ b/test/data/special_characters_escaped.md @@ -0,0 +1,13 @@ +AT&T has an ampersand in their name + +this & that + +4 < 5 and 6 > 5 + +strikethrough
here's one followed by another one
~~ this ~~ is not one neither is ~this~
\ No newline at end of file diff --git a/test/data/strikethrough_escaped.md b/test/data/strikethrough_escaped.md new file mode 100644 index 000000000..d169144d2 --- /dev/null +++ b/test/data/strikethrough_escaped.md @@ -0,0 +1,5 @@ +~~strikethrough~~ + +here's ~~one~~ followed by ~~another one~~ + +~~ this ~~ is not one neither is ~this~ \ No newline at end of file diff --git a/test/data/strong_em_escaped.html b/test/data/strong_em_escaped.html new file mode 100644 index 000000000..b709c9914 --- /dev/null +++ b/test/data/strong_em_escaped.html @@ -0,0 +1,6 @@ +em strong em
+strong em em
+em strong em em
+em strong em
+strong em em
+em strong em em
\ No newline at end of file diff --git a/test/data/strong_em_escaped.md b/test/data/strong_em_escaped.md new file mode 100644 index 000000000..f2aa3c782 --- /dev/null +++ b/test/data/strong_em_escaped.md @@ -0,0 +1,11 @@ +*em **strong em*** + +***strong em** em* + +*em **strong em** em* + +_em __strong em___ + +___strong em__ em_ + +_em __strong em__ em_ \ No newline at end of file diff --git a/test/data/tab-indented_code_block_escaped.html b/test/data/tab-indented_code_block_escaped.html new file mode 100644 index 000000000..7c140de73 --- /dev/null +++ b/test/data/tab-indented_code_block_escaped.html @@ -0,0 +1,6 @@ +<?php
+
+$message = 'Hello World!';
+echo $message;
+
+echo "following a blank line";
\ No newline at end of file
diff --git a/test/data/tab-indented_code_block_escaped.md b/test/data/tab-indented_code_block_escaped.md
new file mode 100644
index 000000000..a405a1609
--- /dev/null
+++ b/test/data/tab-indented_code_block_escaped.md
@@ -0,0 +1,6 @@
+
+
+cell
2.1one with a semantic name
+[one][404] with no definition
+multiline +one defined on 2 lines
+one with a mixed case label and an upper case definition
+one with the a label on the next line
+ \ No newline at end of file diff --git a/test/data/text_reference_escaped.md b/test/data/text_reference_escaped.md new file mode 100644 index 000000000..1a66a5cf6 --- /dev/null +++ b/test/data/text_reference_escaped.md @@ -0,0 +1,21 @@ +[reference link][1] + +[1]: http://example.com + +[one][website] with a semantic name + +[website]: http://example.com + +[one][404] with no definition + +[multiline +one][website] defined on 2 lines + +[one][Label] with a mixed case label and an upper case definition + +[LABEL]: http://example.com + +[one] +[1] with the a label on the next line + +[`link`][website] \ No newline at end of file diff --git a/test/data/unordered_list_escaped.html b/test/data/unordered_list_escaped.html new file mode 100644 index 000000000..cd95567b7 --- /dev/null +++ b/test/data/unordered_list_escaped.html @@ -0,0 +1,10 @@ +mixed markers:
+header 1 | +header 2 | +
---|---|
cell 1.1 | +cell 1.2 | +
cell 2.1 | +cell 2.2 | +
an autolink http://example.com
+inside of brackets [http://example.com], inside of braces {http://example.com}, inside of parentheses (http://example.com)
+trailing slash http://example.com/ and http://example.com/path/
\ No newline at end of file diff --git a/test/data/url_autolinking_escaped.md b/test/data/url_autolinking_escaped.md new file mode 100644 index 000000000..840f35404 --- /dev/null +++ b/test/data/url_autolinking_escaped.md @@ -0,0 +1,5 @@ +an autolink http://example.com + +inside of brackets [http://example.com], inside of braces {http://example.com}, inside of parentheses (http://example.com) + +trailing slash http://example.com/ and http://example.com/path/ \ No newline at end of file diff --git a/test/data/whitespace_escaped.html b/test/data/whitespace_escaped.html new file mode 100644 index 000000000..f2dd7a002 --- /dev/null +++ b/test/data/whitespace_escaped.html @@ -0,0 +1 @@ +code
\ No newline at end of file
diff --git a/test/data/whitespace_escaped.md b/test/data/whitespace_escaped.md
new file mode 100644
index 000000000..4cf926a8a
--- /dev/null
+++ b/test/data/whitespace_escaped.md
@@ -0,0 +1,5 @@
+
+
+ code
+
+
\ No newline at end of file