{ "regular_tests": [ { "name": "codeblock_hilite", "input": "Hamlet said:\n~~~~.python \ndef speak(self):\n x = 1\n~~~~", "expected_output": "

Hamlet said:

\n
def speak(self):\n    x = 1\n
", "bugdown_matches_marked": false }, { "name": "basic_paragraph", "input": "test_input", "expected_output": "

test_input

", "bugdown_matches_marked": true }, { "name": "codeblock_multiline", "input": "Hamlet once said\n~~~~\ndef func():\n x = 1\n\n y = 2\n\n z = 3\n~~~~\nAnd all was good.", "expected_output": "

Hamlet once said

\n
def func():\n    x = 1\n\n    y = 2\n\n    z = 3\n
\n\n\n

And all was good.

", "bugdown_matches_marked": true }, { "name": "codeblock_backticks", "input": "\n```\nfenced code\n```\n\n```inline code```\n", "expected_output": "
fenced code\n
\n\n\n

inline code

", "bugdown_matches_marked": true }, { "name": "hanging_multi_codeblock", "input": "Hamlet said:\n~~~~\ndef speak(self):\n x = 1\n# Comment to make this code block longer to test Trac #1162\n~~~~\n\nThen he mentioned ````y = 4 + x**2```` and\n~~~~\ndef foobar(self):\n return self.baz()", "expected_output": "

Hamlet said:

\n
def speak(self):\n    x = 1\n# Comment to make this code block longer to test Trac #1162\n
\n\n\n

Then he mentioned y = 4 + x**2 and

\n
def foobar(self):\n    return self.baz()\n
", "bugdown_matches_marked": true }, { "name": "fenced_quote", "input": "Hamlet said:\n~~~ quote\nTo be or **not** to be.\n\nThat is the question\n~~~", "expected_output": "

Hamlet said:

\n
\n

To be or not to be.

\n

That is the question

\n
", "bugdown_matches_marked": true }, { "name": "fenced_nested_quote", "input": "Hamlet said:\n~~~ quote\nPolonius said:\n> This above all: to thine ownself be true,\nAnd it must follow, as the night the day,\nThou canst not then be false to any man.\n\nWhat good advice!\n~~~", "expected_output": "

Hamlet said:

\n
\n

Polonius said:

\n
\n

This above all: to thine ownself be true,
\nAnd it must follow, as the night the day,
\nThou canst not then be false to any man.

\n
\n

What good advice!

\n
", "bugdown_matches_marked": true }, { "name": "complexly_nested_quote", "input": "I heard about this second hand...\n~~~ quote\n\nHe said:\n~~~ quote\nThe customer is complaining.\n\nThey looked at this code:\n``` \ndef hello(): print 'hello\n```\nThey would prefer:\n~~~\ndef hello()\n puts 'hello'\nend\n~~~\n\nPlease advise.\n~~~\n\nShe said:\n~~~ quote\nJust send them this:\n```\necho \"hello\n\"\n```\n~~~", "expected_output": "

I heard about this second hand...

\n
\n

He said:

\n
\n

The customer is complaining.

\n

They looked at this code:

\n
def hello(): print 'hello\n
\n\n\n

They would prefer:

\n
\n

def hello()
\n puts 'hello'
\nend

\n
\n

Please advise.

\n
She said:\n~~~ quote\nJust send them this:\n```\necho "hello\n"\n```\n
", "bugdown_matches_marked": false }, { "name": "dangerous_block", "input": "xxxxxx xxxxx xxxxxxxx xxxx. x xxxx xxxxxxxxxx:\n\n```\"xxxx xxxx\\xxxxx\\xxxxxx\"```\n\nxxx xxxx xxxxx:```xx.xxxxxxx(x'^xxxx$', xx.xxxxxxxxx)```\n\nxxxxxxx'x xxxx xxxxxxxxxx ```'xxxx'```, xxxxx xxxxxxxxx xxxxx ^ xxx $ xxxxxx xxxxx xxxxxxxxxxxx xxx xxxx xx x xxxx xx xxxx xx xxx xxxxx xxxxxx?", "expected_output": "

xxxxxx xxxxx xxxxxxxx xxxx. x xxxx xxxxxxxxxx:

\n

\"xxxx xxxx\\xxxxx\\xxxxxx\"

\n

xxx xxxx xxxxx:xx.xxxxxxx(x'^xxxx$', xx.xxxxxxxxx)

\n

xxxxxxx'x xxxx xxxxxxxxxx 'xxxx', xxxxx xxxxxxxxx xxxxx ^ xxx $ xxxxxx xxxxx xxxxxxxxxxxx xxx xxxx xx x xxxx xx xxxx xx xxx xxxxx xxxxxx?

", "bugdown_matches_marked": false }, { "name": "dangerous_block", "input": "``` one ```\n\n``` two ```\n\n~~~~\nx = 1", "expected_output": "

one

\n

two

\n
x = 1\n
", "bugdown_matches_marked": true }, { "name": "ulist_standard", "input": "Some text with a list:\n\n* One item\n* Two items\n* Three items", "expected_output": "

Some text with a list:

\n", "bugdown_matches_marked": true }, { "name": "ulist_hanging", "input": "Some text with a hanging list:\n* One item\n* Two items\n* Three items", "expected_output": "

Some text with a hanging list:

\n", "bugdown_matches_marked": true }, { "name": "ulist_hanging_mixed", "input": "Plain list\n\n* Alpha\n\n* Beta\n\nThen hang it off:\n* Ypsilon\n* Zeta", "expected_output": "

Plain list

\n\n

Then hang it off:

\n", "bugdown_matches_marked": false }, { "name": "ulist_hanging_multi", "input": "Plain list\n* Alpha\n* Beta\n\nAnd Again:\n* A\n* B\n* C\n\nOnce more for feeling:\n* Q\n* E\n* D", "expected_output": "

Plain list

\n\n

And Again:

\n\n

Once more for feeling:

\n", "bugdown_matches_marked": true }, { "name": "ulist_codeblock", "input": "~~~\nint x = 3\n* 4;\n~~~", "expected_output": "
int x = 3\n* 4;\n
", "bugdown_matches_marked": true }, { "name": "malformed_fence", "input": "~~~~~~~~xxxxxxxxx: xxxxxxxxxxxx xxxxx x xxxxxxxx~~~~~~", "expected_output": "

~~~~~~~~xxxxxxxxx: xxxxxxxxxxxx xxxxx x xxxxxxxx~~~~~~

", "bugdown_matches_marked": true }, { "name": "strikthrough_basic", "input": "I like ~~software~~ hardware", "expected_output": "

I like software hardware

", "bugdown_matches_marked": true }, { "name": "strikthrough_multiword", "input": "I ~~like software~~ love hardware", "expected_output": "

I like software love hardware

", "bugdown_matches_marked": true }, { "name": "strikthrough_multiword", "input": "I ~~ like software ~~ love hardware", "expected_output": "

I like software love hardware

", "bugdown_matches_marked": true }, { "name": "underscore_disabled", "input": "_foo_", "expected_output": "

_foo_

", "bugdown_matches_marked": true }, { "name": "emphasis_text", "input": "*foo*", "expected_output": "

foo

", "bugdown_matches_marked": true }, { "name": "emphasis_code", "input": "const char *x = (char *)y", "expected_output": "

const char *x = (char *)y

", "bugdown_matches_marked": true }, { "name": "emphasis_with_space", "input": "A *foo bar* is a *baz quux*", "expected_output": "

A foo bar is a baz quux

", "bugdown_matches_marked": true }, { "name": "underscore_strong_disabled", "input": "__foo__", "expected_output": "

__foo__

", "bugdown_matches_marked": true }, { "name": "star_strong", "input": "**foo**", "expected_output": "

foo

", "bugdown_matches_marked": true }, { "name": "linkify_interference", "input": "link: xx, x xxxxx xx xxxx xx\n\n[xxxxx #xx](http://xxxxxxxxx:xxxx/xxx/xxxxxx%xxxxxx/xx/):**xxxxxxx**\n\nxxxxxxx xxxxx xxxx xxxxx:\n`xxxxxx`: xxxxxxx\n`xxxxxx`: xxxxx\n`xxxxxx`: xxxxx xxxxx", "expected_output": "

link: xx, x xxxxx xx xxxx xx

\n

xxxxx #xx:xxxxxxx

\n

xxxxxxx xxxxx xxxx xxxxx:
\nxxxxxx: xxxxxxx
\nxxxxxx: xxxxx
\nxxxxxx: xxxxx xxxxx

", "bugdown_matches_marked": true }, { "name": "inline_image", "input": "Google logo today: https://www.google.com/images/srpr/logo4w.png\nKinda boring", "expected_output": "

Google logo today: https://www.google.com/images/srpr/logo4w.png
\nKinda boring

\n
", "bugdown_matches_marked": false }, { "name": "two_inline_images", "input": "Google logo today: https://www.google.com/images/srpr/logo4w.png\nKinda boringGoogle logo today: https://www.google.com/images/srpr/logo4w.png\nKinda boring", "expected_output": "

Google logo today: https://www.google.com/images/srpr/logo4w.png
\nKinda boringGoogle logo today: https://www.google.com/images/srpr/logo4w.png
\nKinda boring

\n
", "bugdown_matches_marked": false }, { "name": "camo", "input": "Google logo today: http://www.google.com/images/srpr/logo4w.png", "expected_output": "

Google logo today: http://www.google.com/images/srpr/logo4w.png

\n
", "bugdown_matches_marked": false }, { "name": "nl2br", "input": "test\nbar", "expected_output": "

test
\nbar

", "bugdown_matches_marked": true }, { "name": "nl2br_trailing_space", "input": "test ", "expected_output": "

test

", "bugdown_matches_marked": true }, { "name": "tables", "input": "This is a table:\n\nFirst Header | Second Header\n------------- | -------------\nContent Cell | Content Cell\nContent Cell | Content Cell\n", "expected_output": "

This is a table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
First HeaderSecond Header
Content CellContent Cell
Content CellContent Cell
", "bugdown_matches_marked": true }, { "name": "multiline_strong", "input": "You can check out **any time you'd like\nBut you can never leave**", "expected_output": "

You can check out **any time you'd like
\nBut you can never leave**

", "bugdown_matches_marked": false }, { "name": "many_emoji", "input": "test :smile: again :poop:\n:) foo:)bar x::y::z :wasted waste: :fakeemojithisshouldnotrender:", "expected_output": "

test \":smile:\" again \":poop:\"
\n:) foo:)bar x::y::z :wasted waste: :fakeemojithisshouldnotrender:

", "bugdown_matches_marked": true }, { "name": "random_emoji_1", "input": ":airplane:", "expected_output": "

\":airplane:\"

", "bugdown_matches_marked": true }, { "name": "zulip_emoji", "input": ":zulip:", "expected_output": "

\":zulip:\"

", "bugdown_matches_marked": true }, { "name": "random_emoji_2", "input": ":poop:", "expected_output": "

\":poop:\"

", "bugdown_matches_marked": true }, { "name": "emojis_without_space", "input": ":cat:hello:dog::rabbit:", "expected_output": "

\":cat:\"hello\":dog:\"\":rabbit:\"

", "bugdown_matches_marked": true }, { "name": "emojis_newline", "input": ":cat:\n:dog:", "expected_output": "

\":cat:\"
\n\":dog:\"

", "bugdown_matches_marked": true }, { "name": "not_emoji", "input": ":not_an_emoji:", "expected_output": "

:not_an_emoji:

", "bugdown_matches_marked": true }, { "name": "unicode_emoji", "input": "\ud83d\udca9", "expected_output":"

\"\ud83d\udca9\"<\/p>", "bugdown_matches_marked": true }, { "name": "two_unicode_emoji", "input": "\ud83d\udca9\ud83d\udca9", "expected_output":"

\"\ud83d\udca9\"\"\ud83d\udca9\"<\/p>", "bugdown_matches_marked": true }, { "name": "two_unicode_emoji_separated_by_text", "input": "\ud83d\udca9 word \ud83d\udca9", "expected_output":"

\"\ud83d\udca9\" word \"\ud83d\udca9\"<\/p>", "bugdown_matches_marked": true }, { "name": "miscellaneous_and_dingbats_emoji", "input": "\u2693\u2797", "expected_output":"

\"\u2693\"\"\u2797\"<\/p>", "bugdown_matches_marked": true }, { "name": "unicode_emoji_without_space", "input": "Extra\ud83d\udc7dTerrestrial", "expected_output":"

Extra\"\ud83d\udc7d\"Terrestrial<\/p>", "bugdown_matches_marked": true }, { "name": "unicode_emojis_new_line", "input": "\ud83d\udc7d\n\ud83d\udc7d", "expected_output":"

\"\ud83d\udc7d\"
\n\"\ud83d\udc7d\"<\/p>", "bugdown_matches_marked": true }, { "name": "emoji_alongside_punctuation", "input": ":smile:, :smile:; :smile:", "expected_output": "

\":smile:\", \":smile:\"; \":smile:\"

", "bugdown_matches_marked": true }, { "name": "safe_html", "input": "

stay normal

thanks", "expected_output": "

<h1>stay normal</h1> thanks

", "bugdown_matches_marked": true }, { "name": "safe_html_with_simple_script_tag", "input": "", "expected_output": "

<script>alert(1)</script>

", "bugdown_matches_marked": false }, { "name": "safe_html_nested_script_tag", "input": "</script>", "expected_output": "

<<script>script>evil()<</script>/script>

", "bugdown_matches_marked": true }, { "name": "safe_html_nested_script_tag_with_parse_error", "input": "<script>evil()</script>", "expected_output": "

<<x>script>evil()<</x>/script>

", "bugdown_matches_marked": true }, { "name": "safe_html_messed_up_complexly_nested_script_tags", "input": "ipt type=\"text/javascript\">alert(\"foo\");script>", "expected_output": "

<scr<script></script>ipt type=\"text/javascript\">alert(\"foo\");</<script></script>script<del></del>>

", "bugdown_matches_marked": false }, { "name": "safe_html_unclosed_tag", "input": "