diff --git a/zerver/fixtures/markdown_test_cases.json b/zerver/fixtures/markdown_test_cases.json index e6b155d38e..b7b7e652ed 100644 --- a/zerver/fixtures/markdown_test_cases.json +++ b/zerver/fixtures/markdown_test_cases.json @@ -4,151 +4,176 @@ "name": "codeblock_hilite", "input": "Hamlet said:\n~~~~.python \ndef speak(self):\n x = 1\n~~~~", "expected_output": "
Hamlet said:
\ndef speak(self):\n x = 1\n
Hamlet said:
\ndef speak(self):\n x = 1\n
Hamlet said:
\ndef speak(self):\n x = 1\n
test_input
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "test_input" }, { "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
\ndef func():\n x = 1\n\n y = 2\n\n z = 3\n
And all was good.
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "Hamlet once said\ndef func():\n x = 1\n\n y = 2\n\n z = 3\n\n\n\nAnd all was good." }, { "name": "codeblock_trailing_whitespace", "input": "Hamlet once said\n~~~~\ndef func():\n x = 1\n\n y = 2\t\t\n\n z = 3 \n~~~~\nAnd all was good.", "expected_output": "Hamlet once said
\ndef func():\n x = 1\n\n y = 2\n\n z = 3\n
And all was good.
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "Hamlet once said\ndef func():\n x = 1\n\n y = 2\n\n z = 3\n\n\n\nAnd all was good." }, { "name": "codeblock_backticks", "input": "\n```\nfenced code\n```\n\n```inline code```\n", "expected_output": "fenced code\n
inline code
Hamlet said:
\ndef speak(self):\n x = 1\n# Comment to make this code block longer to test Trac #1162\n
Then he mentioned y = 4 + x**2
and
def foobar(self):\n return self.baz()\n
Hamlet said:
\n\n", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "Hamlet said:\n\nTo be or not to be.\nThat is the question\n" }, { "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": "To be or not to be.
\nThat is the question
\n
Hamlet said:
\n\n", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "Hamlet said:\n\nPolonius said:\n\nThis 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" }, { "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": "Polonius said:
\n\n\nThis above all: to thine ownself be true,
\n
\nAnd it must follow, as the night the day,
\nThou canst not then be false to any man.What good advice!
\n
I heard about this second hand...
\n\n\nHe said:
\n\n\nThe customer is complaining.
\nThey looked at this code:
\n\n\n\ndef hello(): print 'hello\nThey would prefer:
\ndef hello()
\n
\n puts 'hello'
\nend
Please advise.
\nShe said:\n~~~ quote\nJust send them this:\n```\necho "hello\n"\n```\n
\n", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "\n# line 1\n# line 2\n" }, { "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": "# line 1
\n
\n# line 2
xxxxxx xxxxx xxxxxxxx xxxx. x xxxx xxxxxxxxxx:
\n\"xxxx xxxx\\xxxxx\\xxxxxx\"
xxx xxxx xxxxx:xx.xxxxxxx(x'^xxxx$', xx.xxxxxxxxx)
xxxxxxx'x xxxx xxxxxxxxxx 'xxxx'
, xxxxx xxxxxxxxx xxxxx ^ xxx $ xxxxxx xxxxx xxxxxxxxxxxx xxx xxxx xx x xxxx xx xxxx xx xxx xxxxx xxxxxx?
one
two
x = 1\n
def foo(): pass\n
def foo(): pass\n
def foo(): pass\n
notcode
", - "marked_expected_output": "notcode
" + "marked_expected_output": "notcode
", + "text_content": "notcode" }, { "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:
\nSome text with a hanging list:
\nPlain list
\nAlpha
\nBeta
\nThen hang it off:
\nPlain list
\nAnd Again:
\nOnce more for feeling:
\nNested list
\nint x = 3\n* 4;\n
~~~~~~~~xxxxxxxxx: xxxxxxxxxxxx xxxxx x xxxxxxxx~~~~~~
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "~~~~~~~~xxxxxxxxx: xxxxxxxxxxxx xxxxx x xxxxxxxx~~~~~~" }, { "name": "strikthrough_basic", "input": "I like ~~software~~ hardware", "expected_output": "I like software hardware
I like software love hardware
I like software love hardware
foo
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "foo" }, { "name": "emphasis_code", @@ -172,7 +198,8 @@ "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 + "bugdown_matches_marked": true, + "text_content": "A foo bar is a baz quux" }, { "name": "underscore_strong_disabled", @@ -184,31 +211,36 @@ "name": "star_strong", "input": "**foo**", "expected_output": "foo
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "foo" }, { "name": "numbered_list", "input": "1. A\n 2. B", "expected_output": "1. A
\n 2. B
link: xx, x xxxxx xx xxxx xx
\nxxxxx #xx:xxxxxxx
\nxxxxxxx xxxxx xxxx xxxxx:
\nxxxxxx
: xxxxxxx
\nxxxxxx
: xxxxx
\nxxxxxx
: xxxxx xxxxx
Google logo today: https://www.google.com/images/srpr/logo4w.png
\nKinda boring
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
test
\nbar
test
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "test " }, { "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:
\nFirst Header | \nSecond Header | \n
---|---|
Content Cell | \nContent Cell | \n
Content Cell | \nContent Cell | \n
You can check out **any time you'd like
\nBut you can never leave**
test :smile: again :poop:
\n:) foo:)bar x::y::z :wasted waste: :fakeemojithisshouldnotrender:
:cat:hello:dog::rabbit:
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "\ud83d\udc31hello\ud83d\udc36\ud83d\udc30" }, { "name": "emojis_newline", "input": ":cat:\n:dog:", "expected_output": ":cat:
\n:dog:
:not_an_emoji:
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": ":not_an_emoji:" }, { "name": "unicode_emoji", "input": "\ud83d\udca9", "expected_output":":poop:
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "\ud83d\udca9" }, { "name": "two_unicode_emoji", "input": "\ud83d\udca9\ud83d\udca9", "expected_output":":poop::poop:<\/p>", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "\ud83d\udca9\ud83d\udca9" }, { "name": "two_unicode_emoji_separated_by_text", "input": "\ud83d\udca9 word \ud83d\udca9", "expected_output":"
:poop: word :poop:<\/p>", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "\ud83d\udca9 word \ud83d\udca9" }, { "name": "miscellaneous_symbols_and_pictographs", "input": "Merry Christmas!!\ud83c\udf84", "expected_output":"
Merry Christmas!!:christmas_tree:<\/p>", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "Merry Christmas!!\ud83c\udf84" }, { "name": "miscellaneous_and_dingbats_emoji", @@ -334,7 +379,8 @@ "name": "unicode_emojis_new_line", "input": "\ud83d\udc7d\n\ud83d\udc7d", "expected_output":"
:alien:
\n:alien:
Emojis like :man-girl-girl: which have ZWJ are banned for now.
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "Emojis like :man-girl-girl: which have ZWJ are banned for now." }, { "name": "safe_html", "input": "<h1>stay normal</h1> thanks
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "<script>alert(1)</script>
", - "bugdown_matches_marked": false + "bugdown_matches_marked": false, + "text_content": "/script>", "expected_output": "<<script>script>evil()<</script>/script>
", - "bugdown_matches_marked": true + "bugdown_matches_marked": true, + "text_content": "<