mirror of
https://github.com/danog/blackfriday.git
synced 2024-11-30 04:29:13 +01:00
parent
2ab1ea34bd
commit
646308596a
@ -19,6 +19,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestPrefixHeaderNoExtensions(t *testing.T) {
|
func TestPrefixHeaderNoExtensions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"# Header 1\n",
|
"# Header 1\n",
|
||||||
"<h1>Header 1</h1>\n",
|
"<h1>Header 1</h1>\n",
|
||||||
@ -88,6 +89,7 @@ func TestPrefixHeaderNoExtensions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPrefixHeaderSpaceExtension(t *testing.T) {
|
func TestPrefixHeaderSpaceExtension(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"# Header 1\n",
|
"# Header 1\n",
|
||||||
"<h1>Header 1</h1>\n",
|
"<h1>Header 1</h1>\n",
|
||||||
@ -148,6 +150,7 @@ func TestPrefixHeaderSpaceExtension(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPrefixHeaderIdExtension(t *testing.T) {
|
func TestPrefixHeaderIdExtension(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"# Header 1 {#someid}\n",
|
"# Header 1 {#someid}\n",
|
||||||
"<h1 id=\"someid\">Header 1</h1>\n",
|
"<h1 id=\"someid\">Header 1</h1>\n",
|
||||||
@ -208,6 +211,7 @@ func TestPrefixHeaderIdExtension(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPrefixHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
|
func TestPrefixHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"# header 1 {#someid}\n",
|
"# header 1 {#someid}\n",
|
||||||
"<h1 id=\"PRE:someid:POST\">header 1</h1>\n",
|
"<h1 id=\"PRE:someid:POST\">header 1</h1>\n",
|
||||||
@ -260,6 +264,7 @@ func TestPrefixHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPrefixAutoHeaderIdExtension(t *testing.T) {
|
func TestPrefixAutoHeaderIdExtension(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"# Header 1\n",
|
"# Header 1\n",
|
||||||
"<h1 id=\"header-1\">Header 1</h1>\n",
|
"<h1 id=\"header-1\">Header 1</h1>\n",
|
||||||
@ -311,6 +316,7 @@ func TestPrefixAutoHeaderIdExtension(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPrefixAutoHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
|
func TestPrefixAutoHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"# Header 1\n",
|
"# Header 1\n",
|
||||||
"<h1 id=\"PRE:header-1:POST\">Header 1</h1>\n",
|
"<h1 id=\"PRE:header-1:POST\">Header 1</h1>\n",
|
||||||
@ -372,6 +378,7 @@ func TestPrefixAutoHeaderIdExtensionWithPrefixAndSuffix(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPrefixHeaderLevelOffset(t *testing.T) {
|
func TestPrefixHeaderLevelOffset(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var offsetTests = []struct {
|
var offsetTests = []struct {
|
||||||
offset int
|
offset int
|
||||||
tests []string
|
tests []string
|
||||||
@ -458,6 +465,7 @@ func TestPrefixHeaderLevelOffset(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPrefixMultipleHeaderExtensions(t *testing.T) {
|
func TestPrefixMultipleHeaderExtensions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"# Header\n\n# Header {#header}\n\n# Header 1",
|
"# Header\n\n# Header {#header}\n\n# Header 1",
|
||||||
"<h1 id=\"header\">Header</h1>\n\n<h1 id=\"header-1\">Header</h1>\n\n<h1 id=\"header-1-1\">Header 1</h1>\n",
|
"<h1 id=\"header\">Header</h1>\n\n<h1 id=\"header-1\">Header</h1>\n\n<h1 id=\"header-1-1\">Header 1</h1>\n",
|
||||||
@ -466,6 +474,7 @@ func TestPrefixMultipleHeaderExtensions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUnderlineHeaders(t *testing.T) {
|
func TestUnderlineHeaders(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"Header 1\n========\n",
|
"Header 1\n========\n",
|
||||||
"<h1>Header 1</h1>\n",
|
"<h1>Header 1</h1>\n",
|
||||||
@ -516,6 +525,7 @@ func TestUnderlineHeaders(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUnderlineHeadersAutoIDs(t *testing.T) {
|
func TestUnderlineHeadersAutoIDs(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"Header 1\n========\n",
|
"Header 1\n========\n",
|
||||||
"<h1 id=\"header-1\">Header 1</h1>\n",
|
"<h1 id=\"header-1\">Header 1</h1>\n",
|
||||||
@ -566,6 +576,7 @@ func TestUnderlineHeadersAutoIDs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestHorizontalRule(t *testing.T) {
|
func TestHorizontalRule(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"-\n",
|
"-\n",
|
||||||
"<p>-</p>\n",
|
"<p>-</p>\n",
|
||||||
@ -631,6 +642,7 @@ func TestHorizontalRule(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUnorderedList(t *testing.T) {
|
func TestUnorderedList(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"* Hello\n",
|
"* Hello\n",
|
||||||
"<ul>\n<li>Hello</li>\n</ul>\n",
|
"<ul>\n<li>Hello</li>\n</ul>\n",
|
||||||
@ -742,6 +754,7 @@ func TestUnorderedList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestOrderedList(t *testing.T) {
|
func TestOrderedList(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"1. Hello\n",
|
"1. Hello\n",
|
||||||
"<ol>\n<li>Hello</li>\n</ol>\n",
|
"<ol>\n<li>Hello</li>\n</ol>\n",
|
||||||
@ -838,6 +851,7 @@ func TestOrderedList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDefinitionList(t *testing.T) {
|
func TestDefinitionList(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"Term 1\n: Definition a\n",
|
"Term 1\n: Definition a\n",
|
||||||
"<dl>\n<dt>Term 1</dt>\n<dd>Definition a</dd>\n</dl>\n",
|
"<dl>\n<dt>Term 1</dt>\n<dd>Definition a</dd>\n</dl>\n",
|
||||||
@ -940,6 +954,7 @@ func TestDefinitionList(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConsecutiveLists(t *testing.T) {
|
func TestConsecutiveLists(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"1. Hello\n\n* Hello\n\nTerm 1\n: Definition a\n",
|
"1. Hello\n\n* Hello\n\nTerm 1\n: Definition a\n",
|
||||||
"<ol>\n<li>Hello</li>\n</ol>\n\n<ul>\n<li>Hello</li>\n</ul>\n\n<dl>\n<dt>Term 1</dt>\n<dd>Definition a</dd>\n</dl>\n",
|
"<ol>\n<li>Hello</li>\n</ol>\n\n<ul>\n<li>Hello</li>\n</ul>\n\n<dl>\n<dt>Term 1</dt>\n<dd>Definition a</dd>\n</dl>\n",
|
||||||
@ -951,6 +966,7 @@ func TestConsecutiveLists(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPreformattedHtml(t *testing.T) {
|
func TestPreformattedHtml(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"<div></div>\n",
|
"<div></div>\n",
|
||||||
"<div></div>\n",
|
"<div></div>\n",
|
||||||
@ -1004,6 +1020,7 @@ func TestPreformattedHtml(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestPreformattedHtmlLax(t *testing.T) {
|
func TestPreformattedHtmlLax(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"Paragraph\n<div>\nHere? >&<\n</div>\n",
|
"Paragraph\n<div>\nHere? >&<\n</div>\n",
|
||||||
"<p>Paragraph</p>\n\n<div>\nHere? >&<\n</div>\n",
|
"<p>Paragraph</p>\n\n<div>\nHere? >&<\n</div>\n",
|
||||||
@ -1027,6 +1044,7 @@ func TestPreformattedHtmlLax(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFencedCodeBlock(t *testing.T) {
|
func TestFencedCodeBlock(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n",
|
"``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n",
|
||||||
"<pre><code class=\"language-go\">func foo() bool {\n\treturn true;\n}\n</code></pre>\n",
|
"<pre><code class=\"language-go\">func foo() bool {\n\treturn true;\n}\n</code></pre>\n",
|
||||||
@ -1122,6 +1140,7 @@ func TestFencedCodeBlock(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFencedCodeInsideBlockquotes(t *testing.T) {
|
func TestFencedCodeInsideBlockquotes(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
cat := func(s ...string) string { return strings.Join(s, "\n") }
|
cat := func(s ...string) string { return strings.Join(s, "\n") }
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
cat("> ```go",
|
cat("> ```go",
|
||||||
@ -1234,6 +1253,7 @@ okay
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTable(t *testing.T) {
|
func TestTable(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"a | b\n---|---\nc | d\n",
|
"a | b\n---|---\nc | d\n",
|
||||||
"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n</tr>\n</thead>\n\n" +
|
"<table>\n<thead>\n<tr>\n<th>a</th>\n<th>b</th>\n</tr>\n</thead>\n\n" +
|
||||||
@ -1281,6 +1301,7 @@ func TestTable(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUnorderedListWith_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
|
func TestUnorderedListWith_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"* Hello\n",
|
"* Hello\n",
|
||||||
"<ul>\n<li>Hello</li>\n</ul>\n",
|
"<ul>\n<li>Hello</li>\n</ul>\n",
|
||||||
@ -1392,6 +1413,7 @@ func TestUnorderedListWith_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestOrderedList_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
|
func TestOrderedList_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"1. Hello\n",
|
"1. Hello\n",
|
||||||
"<ol>\n<li>Hello</li>\n</ol>\n",
|
"<ol>\n<li>Hello</li>\n</ol>\n",
|
||||||
@ -1488,6 +1510,7 @@ func TestOrderedList_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFencedCodeBlock_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
|
func TestFencedCodeBlock_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n",
|
"``` go\nfunc foo() bool {\n\treturn true;\n}\n```\n",
|
||||||
"<pre><code class=\"language-go\">func foo() bool {\n\treturn true;\n}\n</code></pre>\n",
|
"<pre><code class=\"language-go\">func foo() bool {\n\treturn true;\n}\n</code></pre>\n",
|
||||||
@ -1562,6 +1585,7 @@ func TestFencedCodeBlock_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestListWithFencedCodeBlock(t *testing.T) {
|
func TestListWithFencedCodeBlock(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"1. one\n\n ```\n code\n ```\n\n2. two\n",
|
"1. one\n\n ```\n code\n ```\n\n2. two\n",
|
||||||
"<ol>\n<li><p>one</p>\n\n<pre><code>code\n</code></pre></li>\n\n<li><p>two</p></li>\n</ol>\n",
|
"<ol>\n<li><p>one</p>\n\n<pre><code>code\n</code></pre></li>\n\n<li><p>two</p></li>\n</ol>\n",
|
||||||
@ -1573,6 +1597,7 @@ func TestListWithFencedCodeBlock(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestListWithMalformedFencedCodeBlock(t *testing.T) {
|
func TestListWithMalformedFencedCodeBlock(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
// Ensure that in the case of an unclosed fenced code block in a list,
|
// Ensure that in the case of an unclosed fenced code block in a list,
|
||||||
// no source gets ommitted (even if it is malformed).
|
// no source gets ommitted (even if it is malformed).
|
||||||
// See russross/blackfriday#372 for context.
|
// See russross/blackfriday#372 for context.
|
||||||
@ -1587,6 +1612,7 @@ func TestListWithMalformedFencedCodeBlock(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestListWithFencedCodeBlockNoExtensions(t *testing.T) {
|
func TestListWithFencedCodeBlockNoExtensions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
// If there is a fenced code block in a list, and FencedCode is not set,
|
// If there is a fenced code block in a list, and FencedCode is not set,
|
||||||
// lists should be processed normally.
|
// lists should be processed normally.
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
@ -1600,6 +1626,7 @@ func TestListWithFencedCodeBlockNoExtensions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTitleBlock_EXTENSION_TITLEBLOCK(t *testing.T) {
|
func TestTitleBlock_EXTENSION_TITLEBLOCK(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"% Some title\n" +
|
"% Some title\n" +
|
||||||
"% Another title line\n" +
|
"% Another title line\n" +
|
||||||
@ -1614,6 +1641,7 @@ func TestTitleBlock_EXTENSION_TITLEBLOCK(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBlockComments(t *testing.T) {
|
func TestBlockComments(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"Some text\n\n<!-- comment -->\n",
|
"Some text\n\n<!-- comment -->\n",
|
||||||
"<p>Some text</p>\n\n<!-- comment -->\n",
|
"<p>Some text</p>\n\n<!-- comment -->\n",
|
||||||
@ -1628,6 +1656,7 @@ func TestBlockComments(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTOC(t *testing.T) {
|
func TestTOC(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"# Title\n\n##Subtitle1\n\n##Subtitle2",
|
"# Title\n\n##Subtitle1\n\n##Subtitle2",
|
||||||
//"<nav>\n<ul>\n<li><a href=\"#toc_0\">Title</a>\n<ul>\n<li><a href=\"#toc_1\">Subtitle1</a></li>\n<li><a href=\"#toc_2\">Subtitle2</a></li>\n</ul></li>\n</ul>\n</nav>\n\n<h1 id=\"toc_0\">Title</h1>\n\n<h2 id=\"toc_1\">Subtitle1</h2>\n\n<h2 id=\"toc_2\">Subtitle2</h2>\n",
|
//"<nav>\n<ul>\n<li><a href=\"#toc_0\">Title</a>\n<ul>\n<li><a href=\"#toc_1\">Subtitle1</a></li>\n<li><a href=\"#toc_2\">Subtitle2</a></li>\n</ul></li>\n</ul>\n</nav>\n\n<h1 id=\"toc_0\">Title</h1>\n\n<h2 id=\"toc_1\">Subtitle1</h2>\n\n<h2 id=\"toc_2\">Subtitle2</h2>\n",
|
||||||
@ -1748,6 +1777,7 @@ func TestTOC(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCompletePage(t *testing.T) {
|
func TestCompletePage(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"*foo*",
|
"*foo*",
|
||||||
`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
`<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
@ -1769,6 +1799,7 @@ func TestCompletePage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestIsFenceLine(t *testing.T) {
|
func TestIsFenceLine(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
data []byte
|
data []byte
|
||||||
infoRequested bool
|
infoRequested bool
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestEsc(t *testing.T) {
|
func TestEsc(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
tests := []string{
|
tests := []string{
|
||||||
"abc", "abc",
|
"abc", "abc",
|
||||||
"a&c", "a&c",
|
"a&c", "a&c",
|
||||||
|
@ -21,6 +21,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestEmphasis(t *testing.T) {
|
func TestEmphasis(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"nothing inline\n",
|
"nothing inline\n",
|
||||||
"<p>nothing inline</p>\n",
|
"<p>nothing inline</p>\n",
|
||||||
@ -77,6 +78,7 @@ func TestEmphasis(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestReferenceOverride(t *testing.T) {
|
func TestReferenceOverride(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"test [ref1][]\n",
|
"test [ref1][]\n",
|
||||||
"<p>test <a href=\"http://www.ref1.com/\" title=\"Reference 1\">ref1</a></p>\n",
|
"<p>test <a href=\"http://www.ref1.com/\" title=\"Reference 1\">ref1</a></p>\n",
|
||||||
@ -135,6 +137,7 @@ func TestReferenceOverride(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestStrong(t *testing.T) {
|
func TestStrong(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"nothing inline\n",
|
"nothing inline\n",
|
||||||
"<p>nothing inline</p>\n",
|
"<p>nothing inline</p>\n",
|
||||||
@ -194,6 +197,7 @@ func TestStrong(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEmphasisMix(t *testing.T) {
|
func TestEmphasisMix(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"***triple emphasis***\n",
|
"***triple emphasis***\n",
|
||||||
"<p><strong><em>triple emphasis</em></strong></p>\n",
|
"<p><strong><em>triple emphasis</em></strong></p>\n",
|
||||||
@ -223,6 +227,7 @@ func TestEmphasisMix(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEmphasisLink(t *testing.T) {
|
func TestEmphasisLink(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"[first](before) *text[second] (inside)text* [third](after)\n",
|
"[first](before) *text[second] (inside)text* [third](after)\n",
|
||||||
"<p><a href=\"before\">first</a> <em>text<a href=\"inside\">second</a>text</em> <a href=\"after\">third</a></p>\n",
|
"<p><a href=\"before\">first</a> <em>text<a href=\"inside\">second</a>text</em> <a href=\"after\">third</a></p>\n",
|
||||||
@ -240,6 +245,7 @@ func TestEmphasisLink(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestStrikeThrough(t *testing.T) {
|
func TestStrikeThrough(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"nothing inline\n",
|
"nothing inline\n",
|
||||||
"<p>nothing inline</p>\n",
|
"<p>nothing inline</p>\n",
|
||||||
@ -269,6 +275,7 @@ func TestStrikeThrough(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCodeSpan(t *testing.T) {
|
func TestCodeSpan(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"`source code`\n",
|
"`source code`\n",
|
||||||
"<p><code>source code</code></p>\n",
|
"<p><code>source code</code></p>\n",
|
||||||
@ -307,6 +314,7 @@ func TestCodeSpan(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestLineBreak(t *testing.T) {
|
func TestLineBreak(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"this line \nhas a break\n",
|
"this line \nhas a break\n",
|
||||||
"<p>this line<br />\nhas a break</p>\n",
|
"<p>this line<br />\nhas a break</p>\n",
|
||||||
@ -346,6 +354,7 @@ func TestLineBreak(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestInlineLink(t *testing.T) {
|
func TestInlineLink(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"[foo](/bar/)\n",
|
"[foo](/bar/)\n",
|
||||||
"<p><a href=\"/bar/\">foo</a></p>\n",
|
"<p><a href=\"/bar/\">foo</a></p>\n",
|
||||||
@ -463,6 +472,7 @@ func TestInlineLink(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestRelAttrLink(t *testing.T) {
|
func TestRelAttrLink(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var nofollowTests = []string{
|
var nofollowTests = []string{
|
||||||
"[foo](http://bar.com/foo/)\n",
|
"[foo](http://bar.com/foo/)\n",
|
||||||
"<p><a href=\"http://bar.com/foo/\" rel=\"nofollow\">foo</a></p>\n",
|
"<p><a href=\"http://bar.com/foo/\" rel=\"nofollow\">foo</a></p>\n",
|
||||||
@ -521,6 +531,7 @@ func TestRelAttrLink(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestHrefTargetBlank(t *testing.T) {
|
func TestHrefTargetBlank(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
// internal link
|
// internal link
|
||||||
"[foo](/bar/)\n",
|
"[foo](/bar/)\n",
|
||||||
@ -550,6 +561,7 @@ func TestHrefTargetBlank(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSafeInlineLink(t *testing.T) {
|
func TestSafeInlineLink(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"[foo](/bar/)\n",
|
"[foo](/bar/)\n",
|
||||||
"<p><a href=\"/bar/\">foo</a></p>\n",
|
"<p><a href=\"/bar/\">foo</a></p>\n",
|
||||||
@ -583,6 +595,7 @@ func TestSafeInlineLink(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestReferenceLink(t *testing.T) {
|
func TestReferenceLink(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"[link][ref]\n",
|
"[link][ref]\n",
|
||||||
"<p>[link][ref]</p>\n",
|
"<p>[link][ref]</p>\n",
|
||||||
@ -621,6 +634,7 @@ func TestReferenceLink(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTags(t *testing.T) {
|
func TestTags(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"a <span>tag</span>\n",
|
"a <span>tag</span>\n",
|
||||||
"<p>a <span>tag</span></p>\n",
|
"<p>a <span>tag</span></p>\n",
|
||||||
@ -638,6 +652,7 @@ func TestTags(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAutoLink(t *testing.T) {
|
func TestAutoLink(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"http://foo.com/\n",
|
"http://foo.com/\n",
|
||||||
"<p><a href=\"http://foo.com/\">http://foo.com/</a></p>\n",
|
"<p><a href=\"http://foo.com/\">http://foo.com/</a></p>\n",
|
||||||
@ -943,12 +958,14 @@ what happens here
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFootnotes(t *testing.T) {
|
func TestFootnotes(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
doTestsInlineParam(t, footnoteTests, TestParams{
|
doTestsInlineParam(t, footnoteTests, TestParams{
|
||||||
extensions: Footnotes,
|
extensions: Footnotes,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestFootnotesWithParameters(t *testing.T) {
|
func TestFootnotesWithParameters(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
tests := make([]string, len(footnoteTests))
|
tests := make([]string, len(footnoteTests))
|
||||||
|
|
||||||
prefix := "testPrefix"
|
prefix := "testPrefix"
|
||||||
@ -978,6 +995,7 @@ func TestFootnotesWithParameters(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNestedFootnotes(t *testing.T) {
|
func TestNestedFootnotes(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
`Paragraph.[^fn1]
|
`Paragraph.[^fn1]
|
||||||
|
|
||||||
@ -1005,6 +1023,7 @@ func TestNestedFootnotes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestInlineComments(t *testing.T) {
|
func TestInlineComments(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"Hello <!-- there ->\n",
|
"Hello <!-- there ->\n",
|
||||||
"<p>Hello <!— there –></p>\n",
|
"<p>Hello <!— there –></p>\n",
|
||||||
@ -1034,6 +1053,7 @@ func TestInlineComments(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSmartDoubleQuotes(t *testing.T) {
|
func TestSmartDoubleQuotes(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"this should be normal \"quoted\" text.\n",
|
"this should be normal \"quoted\" text.\n",
|
||||||
"<p>this should be normal “quoted” text.</p>\n",
|
"<p>this should be normal “quoted” text.</p>\n",
|
||||||
@ -1046,6 +1066,7 @@ func TestSmartDoubleQuotes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSmartDoubleQuotesNBSP(t *testing.T) {
|
func TestSmartDoubleQuotesNBSP(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"this should be normal \"quoted\" text.\n",
|
"this should be normal \"quoted\" text.\n",
|
||||||
"<p>this should be normal “ quoted ” text.</p>\n",
|
"<p>this should be normal “ quoted ” text.</p>\n",
|
||||||
@ -1058,6 +1079,7 @@ func TestSmartDoubleQuotesNBSP(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSmartAngledDoubleQuotes(t *testing.T) {
|
func TestSmartAngledDoubleQuotes(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"this should be angled \"quoted\" text.\n",
|
"this should be angled \"quoted\" text.\n",
|
||||||
"<p>this should be angled «quoted» text.</p>\n",
|
"<p>this should be angled «quoted» text.</p>\n",
|
||||||
@ -1070,6 +1092,7 @@ func TestSmartAngledDoubleQuotes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSmartAngledDoubleQuotesNBSP(t *testing.T) {
|
func TestSmartAngledDoubleQuotesNBSP(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"this should be angled \"quoted\" text.\n",
|
"this should be angled \"quoted\" text.\n",
|
||||||
"<p>this should be angled « quoted » text.</p>\n",
|
"<p>this should be angled « quoted » text.</p>\n",
|
||||||
@ -1082,6 +1105,7 @@ func TestSmartAngledDoubleQuotesNBSP(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSmartFractions(t *testing.T) {
|
func TestSmartFractions(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
"1/2, 1/4 and 3/4; 1/4th and 3/4ths\n",
|
"1/2, 1/4 and 3/4; 1/4th and 3/4ths\n",
|
||||||
"<p>½, ¼ and ¾; ¼th and ¾ths</p>\n",
|
"<p>½, ¼ and ¾; ¼th and ¾ths</p>\n",
|
||||||
@ -1100,6 +1124,7 @@ func TestSmartFractions(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDisableSmartDashes(t *testing.T) {
|
func TestDisableSmartDashes(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
doTestsInlineParam(t, []string{
|
doTestsInlineParam(t, []string{
|
||||||
"foo - bar\n",
|
"foo - bar\n",
|
||||||
"<p>foo - bar</p>\n",
|
"<p>foo - bar</p>\n",
|
||||||
@ -1135,6 +1160,7 @@ func TestDisableSmartDashes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSkipLinks(t *testing.T) {
|
func TestSkipLinks(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
doTestsInlineParam(t, []string{
|
doTestsInlineParam(t, []string{
|
||||||
"[foo](gopher://foo.bar)",
|
"[foo](gopher://foo.bar)",
|
||||||
"<p><tt>foo</tt></p>\n",
|
"<p><tt>foo</tt></p>\n",
|
||||||
@ -1147,6 +1173,7 @@ func TestSkipLinks(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSkipImages(t *testing.T) {
|
func TestSkipImages(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
doTestsInlineParam(t, []string{
|
doTestsInlineParam(t, []string{
|
||||||
"![foo](/bar/)\n",
|
"![foo](/bar/)\n",
|
||||||
"<p></p>\n",
|
"<p></p>\n",
|
||||||
@ -1156,6 +1183,7 @@ func TestSkipImages(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestUseXHTML(t *testing.T) {
|
func TestUseXHTML(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
doTestsParam(t, []string{
|
doTestsParam(t, []string{
|
||||||
"---",
|
"---",
|
||||||
"<hr>\n",
|
"<hr>\n",
|
||||||
@ -1167,6 +1195,7 @@ func TestUseXHTML(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSkipHTML(t *testing.T) {
|
func TestSkipHTML(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
doTestsParam(t, []string{
|
doTestsParam(t, []string{
|
||||||
"<div class=\"foo\"></div>\n\ntext\n\n<form>the form</form>",
|
"<div class=\"foo\"></div>\n\ntext\n\n<form>the form</form>",
|
||||||
"<p>text</p>\n\n<p>the form</p>\n",
|
"<p>text</p>\n\n<p>the form</p>\n",
|
||||||
|
@ -16,6 +16,7 @@ package blackfriday
|
|||||||
import "testing"
|
import "testing"
|
||||||
|
|
||||||
func TestDocument(t *testing.T) {
|
func TestDocument(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
var tests = []string{
|
var tests = []string{
|
||||||
// Empty document.
|
// Empty document.
|
||||||
"",
|
"",
|
||||||
|
@ -20,6 +20,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestReference(t *testing.T) {
|
func TestReference(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
files := []string{
|
files := []string{
|
||||||
"Amps and angle encoding",
|
"Amps and angle encoding",
|
||||||
"Auto links",
|
"Auto links",
|
||||||
@ -48,6 +49,7 @@ func TestReference(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestReference_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
|
func TestReference_EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
files := []string{
|
files := []string{
|
||||||
"Amps and angle encoding",
|
"Amps and angle encoding",
|
||||||
"Auto links",
|
"Auto links",
|
||||||
|
Loading…
Reference in New Issue
Block a user