mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
markdown: Update regex for strikethrough.
This uses the correct regex for strikethrough. Also, added a test to make sure that strikethrough works when it contains link with whitespace. Fixes #7596.
This commit is contained in:
@@ -188,6 +188,12 @@
|
|||||||
"expected_output": "<p>I <del> like software </del> love hardware</p>",
|
"expected_output": "<p>I <del> like software </del> love hardware</p>",
|
||||||
"text_content": "I like software love hardware"
|
"text_content": "I like software love hardware"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "strikthrough_link",
|
||||||
|
"input": "~~test http://xx.xx link~~",
|
||||||
|
"expected_output": "<p><del>test <a href=\"http://xx.xx\" target=\"_blank\" title=\"http://xx.xx\">http://xx.xx</a> link</del></p>",
|
||||||
|
"text_content": "test http://xx.xx link"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "underscore_disabled",
|
"name": "underscore_disabled",
|
||||||
"input": "_foo_",
|
"input": "_foo_",
|
||||||
|
|||||||
@@ -1395,7 +1395,7 @@ class Bugdown(markdown.Extension):
|
|||||||
# Custom strikethrough syntax: ~~foo~~
|
# Custom strikethrough syntax: ~~foo~~
|
||||||
md.inlinePatterns.add('del',
|
md.inlinePatterns.add('del',
|
||||||
markdown.inlinepatterns.SimpleTagPattern(
|
markdown.inlinepatterns.SimpleTagPattern(
|
||||||
r'(?<!~)(\~\~)([^~{0}\n]+?)\2(?!~)', 'del'), '>strong')
|
r'(?<!~)(\~\~)([^~\n]+?)(\~\~)(?!~)', 'del'), '>strong')
|
||||||
|
|
||||||
# Text inside ** must start and end with a word character
|
# Text inside ** must start and end with a word character
|
||||||
# it need for things like "const char *x = (char *)y"
|
# it need for things like "const char *x = (char *)y"
|
||||||
|
|||||||
Reference in New Issue
Block a user