// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved. // See License.txt for license information. package markdown import ( "testing" "github.com/stretchr/testify/assert" ) func TestCommonMarkReferenceStrings(t *testing.T) { // For the most part, we aim for CommonMark compliance with the features that we support. We // also support some GitHub flavored extensions. // // You can find most of the references used here: https://github.github.com/gfm/ // CommonMark handles leading tabs that aren't on 4-character boundaries differently, so the // following reference strings will fail. The current implementation is much closer to our // webapp's behavior though, so I'm leaving it as is for now. It doesn't really impact anything // we use this package for anyways. // // " \tfoo\tbaz\t\tbim\n": "
foo\tbaz\t\tbim\n
", // ">\t\tfoo": "
   foo
", for name, tc := range map[string]struct { Markdown string ExpectedHTML string }{ "0.28-gfm-1": { Markdown: "\tfoo\tbaz\t\tbim\n", ExpectedHTML: "
foo\tbaz\t\tbim\n
", }, "0.28-gfm-3": { Markdown: " a\ta\n ὐ\ta\n", ExpectedHTML: "
a\ta\nὐ\ta\n
", }, "0.28-gfm-4": { Markdown: " - foo\n\n\tbar\n", ExpectedHTML: "", }, "0.28-gfm-5": { Markdown: "- foo\n\n\t\tbar", ExpectedHTML: "", }, "0.28-gfm-8": { Markdown: " foo\n\tbar", ExpectedHTML: "
foo\nbar
", }, "0.28-gfm-9": { Markdown: " - foo\n - bar\n\t - baz", ExpectedHTML: "", }, "0.28-gfm-12": { Markdown: "- `one\n- two`", ExpectedHTML: "", }, "0.28-gfm-76": { Markdown: " a simple\n indented code block", ExpectedHTML: "
a simple\n  indented code block
", }, "0.28-gfm-77": { Markdown: " - foo\n\n bar", ExpectedHTML: "", }, "0.28-gfm-78": { Markdown: "1. foo\n\n - bar", ExpectedHTML: "
  1. foo

", }, "0.28-gfm-79": { Markdown: " \n *hi*\n\n - one", ExpectedHTML: "
<a/>\n*hi*\n\n- one
", }, "0.28-gfm-80": { Markdown: " chunk1\n\n chunk2\n \n \n \n chunk3", ExpectedHTML: "
chunk1\n\nchunk2\n\n\n\nchunk3
", }, "0.28-gfm-81": { Markdown: " chunk1\n \n chunk2", ExpectedHTML: "
chunk1\n  \n  chunk2
", }, "0.28-gfm-82": { Markdown: "Foo\n bar", ExpectedHTML: "

Foo\nbar

", }, "0.28-gfm-83": { Markdown: " foo\nbar", ExpectedHTML: "
foo\n

bar

", }, "0.28-gfm-85": { Markdown: " foo\n bar", ExpectedHTML: "
    foo\nbar
", }, "0.28-gfm-86": { Markdown: "\n \n foo\n ", ExpectedHTML: "
foo\n
", }, "0.28-gfm-87": { Markdown: " foo ", ExpectedHTML: "
foo  
", }, "0.28-gfm-88": { Markdown: "```\n<\n >\n```", ExpectedHTML: "
<\n >\n
", }, "0.28-gfm-89": { Markdown: "~~~\n<\n >\n~~~", ExpectedHTML: "
<\n >\n
", }, "0.28-gfm-91": { Markdown: "```\naaa\n~~~\n```", ExpectedHTML: "
aaa\n~~~\n
", }, "0.28-gfm-92": { Markdown: "~~~\naaa\n```\n~~~", ExpectedHTML: "
aaa\n```\n
", }, "0.28-gfm-93": { Markdown: "````\naaa\n```\n``````", ExpectedHTML: "
aaa\n```\n
", }, "0.28-gfm-94": { Markdown: "~~~~\naaa\n~~~\n~~~~", ExpectedHTML: "
aaa\n~~~\n
", }, "0.28-gfm-95": { Markdown: "```", ExpectedHTML: "
", }, "0.28-gfm-96": { Markdown: "`````\n\n```\naaa", ExpectedHTML: "
\n```\naaa
", }, "0.28-gfm-97": { Markdown: "> ```\n> aaa\n\nbbb", ExpectedHTML: "
aaa\n

bbb

", }, "0.28-gfm-98": { Markdown: "```\n\n \n```", ExpectedHTML: "
\n  \n
", }, "0.28-gfm-99": { Markdown: "```\n```", ExpectedHTML: "
", }, "0.28-gfm-100": { Markdown: " ```\n aaa\naaa\n```", ExpectedHTML: "
aaa\naaa\n
", }, "0.28-gfm-101": { Markdown: " ```\naaa\n aaa\naaa\n ```", ExpectedHTML: "
aaa\naaa\naaa\n
", }, "0.28-gfm-102": { Markdown: " ```\n aaa\n aaa\n aaa\n ```", ExpectedHTML: "
aaa\n aaa\naaa\n
", }, "0.28-gfm-103": { Markdown: " ```\n aaa\n ```", ExpectedHTML: "
```\naaa\n```
", }, "0.28-gfm-104": { Markdown: "```\naaa\n ```", ExpectedHTML: "
aaa\n
", }, "0.28-gfm-105": { Markdown: " ```\naaa\n ```", ExpectedHTML: "
aaa\n
", }, "0.28-gfm-106": { Markdown: "```\naaa\n ```", ExpectedHTML: "
aaa\n    ```
", }, "0.28-gfm-108": { Markdown: "~~~~~~\naaa\n~~~ ~~", ExpectedHTML: "
aaa\n~~~ ~~
", }, "0.28-gfm-109": { Markdown: "foo\n```\nbar\n```\nbaz", ExpectedHTML: "

foo

bar\n

baz

", }, "0.28-gfm-111": { Markdown: "```ruby\ndef foo(x)\n return 3\nend\n```", ExpectedHTML: "
def foo(x)\n  return 3\nend\n
", }, "0.28-gfm-112": { Markdown: "```ruby startline=3 $%@#$\ndef foo(x)\n return 3\nend\n```", ExpectedHTML: "
def foo(x)\n  return 3\nend\n
", }, "0.28-gfm-113": { Markdown: "````;\n````", ExpectedHTML: "
", }, "0.28-gfm-115": { Markdown: "```\n``` aaa\n```", ExpectedHTML: "
``` aaa\n
", }, "0.28-gfm-159": { Markdown: "[foo]: /url \"title\"\n\n[foo]", ExpectedHTML: `

foo

`, }, "0.28-gfm-160": { Markdown: " [foo]: \n /url \n 'the title' \n\n[foo]", ExpectedHTML: `

foo

`, }, "0.28-gfm-161": { Markdown: "[Foo*bar\\]]:my_(url) 'title (with parens)'\n\n[Foo*bar\\]]", ExpectedHTML: `

Foo*bar]

`, }, "0.28-gfm-162": { Markdown: "[Foo bar]:\n\n'title'\n\n[Foo bar]", ExpectedHTML: `

Foo bar

`, }, "0.28-gfm-163": { Markdown: "[foo]: /url '\ntitle\nline1\nline2\n'\n\n[foo]", ExpectedHTML: "

foo

", }, "0.28-gfm-164": { Markdown: "[foo]: /url 'title\n\nwith blank line'\n\n[foo]", ExpectedHTML: "

[foo]: /url 'title

with blank line'

[foo]

", }, "0.28-gfm-165": { Markdown: "[foo]:\n/url\n\n[foo]", ExpectedHTML: `

foo

`, }, "0.28-gfm-166": { Markdown: "[foo]:\n\n[foo]", ExpectedHTML: `

[foo]:

[foo]

`, }, "0.28-gfm-167": { Markdown: "[foo]: /url\\bar\\*baz \"foo\\\"bar\\baz\"\n\n[foo]", ExpectedHTML: `

foo

`, }, "0.28-gfm-168": { Markdown: "[foo]\n\n[foo]: url", ExpectedHTML: `

foo

`, }, "0.28-gfm-169": { Markdown: "[foo]\n\n[foo]: first\n[foo]: second", ExpectedHTML: `

foo

`, }, "0.28-gfm-170": { Markdown: "[FOO]: /url\n\n[Foo]", ExpectedHTML: `

Foo

`, }, "0.28-gfm-171": { Markdown: "[ΑΓΩ]: /φου\n\n[αγω]", ExpectedHTML: `

αγω

`, }, "0.28-gfm-172": { Markdown: "[foo]: /url", ExpectedHTML: ``, }, "0.28-gfm-173": { Markdown: "[\nfoo\n]: /url\nbar", ExpectedHTML: `

bar

`, }, "0.28-gfm-174": { Markdown: `[foo]: /url "title" ok`, ExpectedHTML: `

[foo]: /url "title" ok

`, }, "0.28-gfm-175": { Markdown: "[foo]: /url\n\"title\" ok", ExpectedHTML: `

"title" ok

`, }, "0.28-gfm-176": { Markdown: " [foo]: /url \"title\"\n\n[foo]", ExpectedHTML: "
[foo]: /url "title"\n

[foo]

", }, "0.28-gfm-177": { Markdown: "```\n[foo]: /url\n```\n\n[foo]", ExpectedHTML: "
[foo]: /url\n

[foo]

", }, "0.28-gfm-178": { Markdown: "Foo\n[bar]: /baz\n\n[bar]", ExpectedHTML: "

Foo\n[bar]: /baz

[bar]

", }, "0.28-gfm-180": { Markdown: "[foo]: /foo-url \"foo\"\n[bar]: /bar-url\n\"bar\"\n[baz]: /baz-url\n\n[foo],\n[bar],\n[baz]", ExpectedHTML: `

foo, bar, baz

`, }, "0.28-gfm-181": { Markdown: "[foo]\n\n> [foo]: /url", ExpectedHTML: `

foo

`, }, "0.28-gfm-182": { Markdown: "aaa\n\nbbb", ExpectedHTML: "

aaa

bbb

", }, "0.28-gfm-183": { Markdown: "aaa\nbbb\n\nccc\nddd", ExpectedHTML: "

aaa\nbbb

ccc\nddd

", }, "0.28-gfm-184": { Markdown: "aaa\n\n\nbbb", ExpectedHTML: "

aaa

bbb

", }, "0.28-gfm-185": { Markdown: " aaa\n bbb", ExpectedHTML: "

aaa\nbbb

", }, "0.28-gfm-186": { Markdown: "aaa\n bbb\n ccc", ExpectedHTML: "

aaa\nbbb\nccc

", }, "0.28-gfm-187": { Markdown: " aaa\nbbb", ExpectedHTML: "

aaa\nbbb

", }, "0.28-gfm-188": { Markdown: " aaa\nbbb", ExpectedHTML: "
aaa\n

bbb

", }, "0.28-gfm-189": { Markdown: "aaa \nbbb \n", ExpectedHTML: "

aaa
bbb

", }, "0.28-gfm-204": { Markdown: "> bar\nbaz\n> foo", ExpectedHTML: "

bar\nbaz\nfoo

", }, "0.28-gfm-206": { Markdown: "> - foo\n- bar", ExpectedHTML: "
", }, "0.28-gfm-207": { Markdown: "> foo\n bar", ExpectedHTML: "
foo\n
bar
", }, "0.28-gfm-208": { Markdown: "> ```\nfoo\n```", ExpectedHTML: "

foo

", }, "0.28-gfm-209": { Markdown: "> foo\n - bar", ExpectedHTML: "

foo\n- bar

", }, "0.28-gfm-210": { Markdown: ">", ExpectedHTML: "
", }, "0.28-gfm-211": { Markdown: ">\n> \n> ", ExpectedHTML: "
", }, "0.28-gfm-212": { Markdown: ">\n> foo\n> ", ExpectedHTML: "

foo

", }, "0.28-gfm-213": { Markdown: "> foo\n\n> bar", ExpectedHTML: "

foo

bar

", }, "0.28-gfm-214": { Markdown: "> foo\n> bar", ExpectedHTML: "

foo\nbar

", }, "0.28-gfm-215": { Markdown: "> foo\n>\n> bar", ExpectedHTML: "

foo

bar

", }, "0.28-gfm-216": { Markdown: "foo\n> bar", ExpectedHTML: "

foo

bar

", }, "0.28-gfm-218": { Markdown: "> bar\nbaz", ExpectedHTML: "

bar\nbaz

", }, "0.28-gfm-219": { Markdown: "> bar\n\nbaz", ExpectedHTML: "

bar

baz

", }, "0.28-gfm-220": { Markdown: "> bar\n>\nbaz", ExpectedHTML: "

bar

baz

", }, "0.28-gfm-221": { Markdown: "> > > foo\nbar", ExpectedHTML: "

foo\nbar

", }, "0.28-gfm-222": { Markdown: ">>> foo\n> bar\n>>baz", ExpectedHTML: "

foo\nbar\nbaz

", }, "0.28-gfm-223": { Markdown: "> code\n\n> not code", ExpectedHTML: "
code\n

not code

", }, "0.28-gfm-224": { Markdown: "A paragraph\nwith two lines.\n\n indented code\n\n> A block quote.", ExpectedHTML: "

A paragraph\nwith two lines.

indented code\n

A block quote.

", }, "0.28-gfm-225": { Markdown: "1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.", ExpectedHTML: "
  1. A paragraph\nwith two lines.

    indented code\n

    A block quote.

", }, "0.28-gfm-226": { Markdown: "- one\n\n two", ExpectedHTML: "

two

", }, "0.28-gfm-227": { Markdown: "- one\n\n two", ExpectedHTML: "", }, "0.28-gfm-228": { Markdown: " - one\n\n two", ExpectedHTML: "
 two
", }, "0.28-gfm-229": { Markdown: " - one\n\n two", ExpectedHTML: "", }, "0.28-gfm-230": { Markdown: " > > 1. one\n>>\n>> two", ExpectedHTML: "
  1. one

    two

", }, "0.28-gfm-231": { Markdown: ">>- one\n>>\n > > two", ExpectedHTML: "
  • one

two

", }, "0.28-gfm-232": { Markdown: "-one\n\n2.two", ExpectedHTML: "

-one

2.two

", }, "0.28-gfm-233": { Markdown: "- foo\n\n\n bar", ExpectedHTML: "", }, "0.28-gfm-234": { Markdown: "1. foo\n\n ```\n bar\n ```\n\n baz\n\n > bam", ExpectedHTML: "
  1. foo

    bar\n

    baz

    bam

", }, "0.28-gfm-235": { Markdown: "- Foo\n\n bar\n\n\n baz", ExpectedHTML: "", }, "0.28-gfm-236": { Markdown: "123456789. ok", ExpectedHTML: `
  1. ok
`, }, "0.28-gfm-237": { Markdown: "1234567890. not ok", ExpectedHTML: "

1234567890. not ok

", }, "0.28-gfm-238": { Markdown: "0. ok", ExpectedHTML: `
  1. ok
`, }, "0.28-gfm-239": { Markdown: "003. ok", ExpectedHTML: `
  1. ok
`, }, "0.28-gfm-240": { Markdown: "-1. not ok", ExpectedHTML: "

-1. not ok

", }, "0.28-gfm-241": { Markdown: "- foo\n\n bar", ExpectedHTML: "", }, "0.28-gfm-242": { Markdown: " 10. foo\n\n bar", ExpectedHTML: `
  1. foo

    bar
`, }, "0.28-gfm-243": { Markdown: " indented code\n\nparagraph\n\n more code", ExpectedHTML: "
indented code\n

paragraph

more code
", }, "0.28-gfm-244": { Markdown: "1. indented code\n\n paragraph\n\n more code", ExpectedHTML: "
  1. indented code\n

    paragraph

    more code
", }, "0.28-gfm-245": { Markdown: "1. indented code\n\n paragraph\n\n more code", ExpectedHTML: "
  1.  indented code\n

    paragraph

    more code
", }, "0.28-gfm-246": { Markdown: " foo\n\nbar", ExpectedHTML: "

foo

bar

", }, "0.28-gfm-247": { Markdown: "- foo\n\n bar", ExpectedHTML: "

bar

", }, "0.28-gfm-248": { Markdown: "- foo\n\n bar", ExpectedHTML: "", }, "0.28-gfm-249": { Markdown: "-\n foo\n-\n ```\n bar\n ```\n-\n baz", ExpectedHTML: "", }, "0.28-gfm-250": { Markdown: "- \n foo", ExpectedHTML: "", }, "0.28-gfm-251": { Markdown: "-\n\n foo", ExpectedHTML: "

foo

", }, "0.28-gfm-252": { Markdown: "- foo\n-\n- bar", ExpectedHTML: "", }, "0.28-gfm-253": { Markdown: "- foo\n- \n- bar", ExpectedHTML: "", }, "0.28-gfm-254": { Markdown: "1. foo\n2.\n3. bar", ExpectedHTML: "
  1. foo
  2. bar
", }, "0.28-gfm-255": { Markdown: "*", ExpectedHTML: "", }, "0.28-gfm-256": { Markdown: "foo\n*\n\nfoo\n1.", ExpectedHTML: "

foo\n*

foo\n1.

", }, "0.28-gfm-257": { Markdown: " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.", ExpectedHTML: "
  1. A paragraph\nwith two lines.

    indented code\n

    A block quote.

", }, "0.28-gfm-258": { Markdown: " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.", ExpectedHTML: "
  1. A paragraph\nwith two lines.

    indented code\n

    A block quote.

", }, "0.28-gfm-259": { Markdown: " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.", ExpectedHTML: "
  1. A paragraph\nwith two lines.

    indented code\n

    A block quote.

", }, "0.28-gfm-260": { Markdown: " 1. A paragraph\n with two lines.\n\n indented code\n\n > A block quote.", ExpectedHTML: "
1.  A paragraph\n    with two lines.\n\n        indented code\n\n    > A block quote.
", }, "0.28-gfm-261": { Markdown: " 1. A paragraph\nwith two lines.\n\n indented code\n\n > A block quote.", ExpectedHTML: "
  1. A paragraph\nwith two lines.

    indented code\n

    A block quote.

", }, "0.28-gfm-262": { Markdown: " 1. A paragraph\n with two lines.", ExpectedHTML: "
  1. A paragraph\nwith two lines.
", }, "0.28-gfm-263": { Markdown: "> 1. > Blockquote\ncontinued here.", ExpectedHTML: "
  1. Blockquote\ncontinued here.

", }, "0.28-gfm-264": { Markdown: "> 1. > Blockquote\n> continued here.", ExpectedHTML: "
  1. Blockquote\ncontinued here.

", }, "0.28-gfm-265": { Markdown: "- foo\n - bar\n - baz\n - boo", ExpectedHTML: "", }, "0.28-gfm-266": { Markdown: "- foo\n - bar\n - baz\n - boo", ExpectedHTML: "", }, "0.28-gfm-267": { Markdown: "10) foo\n - bar", ExpectedHTML: `
  1. foo
    • bar
`, }, "0.28-gfm-268": { Markdown: "10) foo\n - bar", ExpectedHTML: `
  1. foo
`, }, "0.28-gfm-269": { Markdown: "- - foo", ExpectedHTML: "", }, "0.28-gfm-270": { Markdown: "1. - 2. foo", ExpectedHTML: `
      1. foo
`, }, "0.28-gfm-274": { Markdown: "- foo\n- bar\n+ baz", ExpectedHTML: "", }, "0.28-gfm-275": { Markdown: "1. foo\n2. bar\n3) baz", ExpectedHTML: `
  1. foo
  2. bar
  1. baz
`, }, "0.28-gfm-276": { Markdown: "Foo\n- bar\n- baz", ExpectedHTML: "

Foo

", }, "0.28-gfm-277": { Markdown: "The number of windows in my house is\n14. The number of doors is 6.", ExpectedHTML: "

The number of windows in my house is\n14. The number of doors is 6.

", }, "0.28-gfm-278": { Markdown: "The number of windows in my house is\n1. The number of doors is 6.", ExpectedHTML: "

The number of windows in my house is

  1. The number of doors is 6.
", }, "0.28-gfm-279": { Markdown: "- foo\n\n- bar\n\n\n- baz", ExpectedHTML: "", }, "0.28-gfm-280": { Markdown: "- foo\n - bar\n - baz\n\n\n bim", ExpectedHTML: "", }, "0.28-gfm-283": { Markdown: "- a\n - b\n - c\n - d\n - e\n - f\n - g\n - h\n- i", ExpectedHTML: "", }, "0.28-gfm-284": { Markdown: "1. a\n\n 2. b\n\n 3. c", ExpectedHTML: "
  1. a

  2. b

  3. c

", }, "0.28-gfm-285": { Markdown: "- a\n- b\n\n- c", ExpectedHTML: "", }, "0.28-gfm-286": { Markdown: "* a\n*\n\n* c", ExpectedHTML: "", }, "0.28-gfm-287": { Markdown: "- a\n- b\n\n c\n- d", ExpectedHTML: "", }, "0.28-gfm-288": { Markdown: "- a\n- b\n\n [ref]: /url\n- d", ExpectedHTML: "", }, "0.28-gfm-289": { Markdown: "- a\n- ```\n b\n\n\n ```\n- c", ExpectedHTML: "", }, "0.28-gfm-290": { Markdown: "- a\n - b\n\n c\n- d", ExpectedHTML: "", }, "0.28-gfm-291": { Markdown: "* a\n > b\n >\n* c", ExpectedHTML: "", }, "0.28-gfm-292": { Markdown: "- a\n > b\n ```\n c\n ```\n- d", ExpectedHTML: "", }, "0.28-gfm-293": { Markdown: "- a", ExpectedHTML: "", }, "0.28-gfm-294": { Markdown: "- a\n - b", ExpectedHTML: "", }, "0.28-gfm-295": { Markdown: "1. ```\n foo\n ```\n\n bar", ExpectedHTML: "
  1. foo\n

    bar

", }, "0.28-gfm-296": { Markdown: "* foo\n * bar\n\n baz", ExpectedHTML: "", }, "0.28-gfm-297": { Markdown: "- a\n - b\n - c\n\n- d\n - e\n - f", ExpectedHTML: "", }, "0.28-gfm-298": { Markdown: "`hi`lo`", ExpectedHTML: "

hilo`

", }, "0.28-gfm-299": { Markdown: `\!\"\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\[\\\]\^\_` + "\\`" + `\{\|\}\~`, ExpectedHTML: "

!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~

", }, "0.28-gfm-300": { Markdown: `\→\A\a\ \3\φ\«`, ExpectedHTML: `

\→\A\a\ \3\φ\«

`, }, "0.28-gfm-301": { Markdown: `\*not emphasized* \
not a tag \[not a link](/foo) \` + "`not code`" + ` 1\. not a list \* not a list \# not a heading \[foo]: /url "not a reference"`, ExpectedHTML: `

*not emphasized* <br/> not a tag [not a link](/foo) ` + "`not code`" + ` 1. not a list * not a list # not a heading [foo]: /url "not a reference"

`, }, "0.28-gfm-304": { Markdown: "`` \\[\\` ``", ExpectedHTML: "

\\[\\`

", }, "0.28-gfm-305": { Markdown: ` \[\]`, ExpectedHTML: `
\[\]
`, }, "0.28-gfm-306": { Markdown: "~~~\n\\[\\]\n~~~", ExpectedHTML: "
\\[\\]\n
", }, "0.28-gfm-309": { Markdown: `[foo](/bar\* "ti\*tle")`, ExpectedHTML: `

foo

`, }, "0.28-gfm-310": { Markdown: `[foo] [foo]: /bar\* "ti\*tle"`, ExpectedHTML: `

foo

`, }, "0.28-gfm-311": { Markdown: "``` foo\\+bar\nfoo\n```", ExpectedHTML: "
foo\n
", }, "0.28-gfm-312": { Markdown: "  & © Æ Ď\n¾ ℋ ⅆ\n∲ ≧̸", ExpectedHTML: "

\u00a0 & © Æ Ď\n¾ ℋ ⅆ\n∲ ≧̸

", }, "0.28-gfm-313": { Markdown: "# Ӓ Ϡ � �", ExpectedHTML: "

# Ӓ Ϡ � �

", }, "0.28-gfm-314": { Markdown: "" ആ ಫ", ExpectedHTML: "

" ആ ಫ

", }, "0.28-gfm-315": { Markdown: "  &x; &#; &#x;\n&ThisIsNotDefined; &hi?;", ExpectedHTML: "

&nbsp &x; &#; &#x;\n&ThisIsNotDefined; &hi?;

", }, "0.28-gfm-316": { Markdown: "©", ExpectedHTML: "

&copy

", }, "0.28-gfm-317": { Markdown: "&MadeUpEntity;", ExpectedHTML: "

&MadeUpEntity;

", }, "0.28-gfm-319": { Markdown: `[foo](/föö "föö")`, ExpectedHTML: `

foo

`, }, "0.28-gfm-320": { Markdown: "[foo]\n\n[foo]: /föö \"föö\"", ExpectedHTML: `

foo

`, }, "0.28-gfm-321": { Markdown: "``` föö\nfoo\n```", ExpectedHTML: "
foo\n
", }, "0.28-gfm-322": { Markdown: "`föö`", ExpectedHTML: "

f&ouml;&ouml;

", }, "0.28-gfm-323": { Markdown: " föfö", ExpectedHTML: "
f&ouml;f&ouml;
", }, "0.28-gfm-324": { Markdown: "`foo`", ExpectedHTML: "

foo

", }, "0.28-gfm-325": { Markdown: "`` foo ` bar ``", ExpectedHTML: "

foo ` bar

", }, "0.28-gfm-326": { Markdown: "` `` `", ExpectedHTML: "

``

", }, "0.28-gfm-327": { Markdown: "``\nfoo\n``", ExpectedHTML: "

foo

", }, "0.28-gfm-328": { Markdown: "`foo bar\n baz`", ExpectedHTML: "

foo bar baz

", }, "0.28-gfm-329": { Markdown: "`a\xa0\xa0b`", ExpectedHTML: "

a\xa0\xa0b

", }, "0.28-gfm-330": { Markdown: "`foo `` bar`", ExpectedHTML: "

foo `` bar

", }, "0.28-gfm-331": { Markdown: "`foo\\`bar`", ExpectedHTML: "

foo\\bar`

", }, "0.28-gfm-332": { Markdown: "*foo`*`", ExpectedHTML: "

*foo*

", }, "0.28-gfm-333": { Markdown: "[not a `link](/foo`)", ExpectedHTML: "

[not a link](/foo)

", }, "0.28-gfm-334": { Markdown: "``", ExpectedHTML: "

<a href="">`

", }, "0.28-gfm-336": { Markdown: "``", ExpectedHTML: "

<http://foo.bar.baz>`

", }, "0.28-gfm-338": { Markdown: "```foo``", ExpectedHTML: "

```foo``

", }, "0.28-gfm-339": { Markdown: "`foo", ExpectedHTML: "

`foo

", }, "0.28-gfm-340": { Markdown: "`foo``bar``", ExpectedHTML: "

`foobar

", }, "0.28-gfm-472": { Markdown: `[link](/uri "title")`, ExpectedHTML: `

link

`, }, "0.28-gfm-473": { Markdown: `[link](/uri)`, ExpectedHTML: `

link

`, }, "0.28-gfm-474": { Markdown: `[link]()`, ExpectedHTML: `

link

`, }, "0.28-gfm-475": { Markdown: `[link](<>)`, ExpectedHTML: `

link

`, }, "0.28-gfm-476": { Markdown: `[link](/my uri)`, ExpectedHTML: `

[link](/my uri)

`, }, "0.28-gfm-477": { Markdown: `[link]()`, ExpectedHTML: `

[link](</my uri>)

`, }, "0.28-gfm-478": { Markdown: "[link](foo\nbar)", ExpectedHTML: "

[link](foo\nbar)

", }, "0.28-gfm-480": { Markdown: `[link](\(foo\))`, ExpectedHTML: `

link

`, }, "0.28-gfm-481": { Markdown: `[link](foo(and(bar)))`, ExpectedHTML: `

link

`, }, "0.28-gfm-482": { Markdown: `[link](foo\(and\(bar\))`, ExpectedHTML: `

link

`, }, "0.28-gfm-483": { Markdown: `[link]()`, ExpectedHTML: `

link

`, }, "0.28-gfm-484": { Markdown: `[link](foo\)\:)`, ExpectedHTML: `

link

`, }, "0.28-gfm-485": { Markdown: "[link](#fragment)\n\n[link](http://example.com#fragment)\n\n[link](http://example.com?foo=3#frag)", ExpectedHTML: `

link

link

link

`, }, "0.28-gfm-486": { Markdown: `[link](foo\bar)`, ExpectedHTML: `

link

`, }, "0.28-gfm-488": { Markdown: `[link]("title")`, ExpectedHTML: `

link

`, }, "0.28-gfm-489": { Markdown: "[link](/url \"title\")\n[link](/url 'title')\n[link](/url (title))", ExpectedHTML: "

link\nlink\nlink

", }, "0.28-gfm-490": { Markdown: `[link](/url "title \""")`, ExpectedHTML: `

link

`, }, "0.28-gfm-491": { Markdown: "[link](/url\u00a0\"title\")", ExpectedHTML: `

link

`, }, "0.28-gfm-492": { Markdown: `[link](/url "title "and" title")`, ExpectedHTML: `

[link](/url "title "and" title")

`, }, "0.28-gfm-493": { Markdown: `[link](/url 'title "and" title')`, ExpectedHTML: `

link

`, }, "0.28-gfm-494": { Markdown: "[link]( /uri\n \"title\" )", ExpectedHTML: `

link

`, }, "0.28-gfm-495": { Markdown: "[link] (/uri)", ExpectedHTML: `

[link] (/uri)

`, }, "0.28-gfm-496": { Markdown: "[link [foo [bar]]](/uri)", ExpectedHTML: `

link [foo [bar]]

`, }, "0.28-gfm-497": { Markdown: "[link] bar](/uri)", ExpectedHTML: `

[link] bar](/uri)

`, }, "0.28-gfm-498": { Markdown: "[link [bar](/uri)", ExpectedHTML: `

[link bar

`, }, "0.28-gfm-499": { Markdown: `[link \[bar](/uri)`, ExpectedHTML: `

link [bar

`, }, "0.28-gfm-501": { Markdown: "[![moon](moon.jpg)](/uri)", ExpectedHTML: `

moon

`, }, "0.28-gfm-502": { Markdown: "[foo [bar](/uri)](/uri)", ExpectedHTML: `

[foo bar](/uri)

`, }, "0.28-gfm-504": { Markdown: "![[[foo](uri1)](uri2)](uri3)", ExpectedHTML: `

[foo](uri2)

`, }, "0.28-gfm-505": { Markdown: "*[foo*](/uri)", ExpectedHTML: `

*foo*

`, }, "0.28-gfm-506": { Markdown: "[foo *bar](baz*)", ExpectedHTML: `

foo *bar

`, }, "0.28-gfm-509": { Markdown: "[foo`](/uri)`", ExpectedHTML: `

[foo](/uri)

`, }, "0.28-gfm-556": { Markdown: `![foo](/url "title")`, ExpectedHTML: `

foo

`, }, "0.28-gfm-558": { Markdown: `![foo ![bar](/url)](/url2)`, ExpectedHTML: `

foo bar

`, }, "0.28-gfm-559": { Markdown: `![foo [bar](/url)](/url2)`, ExpectedHTML: `

foo bar

`, }, "0.28-gfm-562": { Markdown: `![foo](train.jpg)`, ExpectedHTML: `

foo

`, }, "0.28-gfm-563": { Markdown: `My ![foo bar](/path/to/train.jpg "title" )`, ExpectedHTML: `

My foo bar

`, }, "0.28-gfm-564": { Markdown: `![foo]()`, ExpectedHTML: `

foo

`, }, "0.28-gfm-565": { Markdown: `![](/url)`, ExpectedHTML: `

`, }, "0.28-gfm-647": { Markdown: "hello $.;'there", ExpectedHTML: "

hello $.;'there

", }, "0.28-gfm-648": { Markdown: "Foo χρῆν", ExpectedHTML: "

Foo χρῆν

", }, "0.28-gfm-649": { Markdown: "Multiple spaces", ExpectedHTML: "

Multiple spaces

", }, } { t.Run(name, func(t *testing.T) { assert.Equal(t, tc.ExpectedHTML, RenderHTML(tc.Markdown)) }) } }