From ef51a395528afaf6eae6e2065f8481bd65922e09 Mon Sep 17 00:00:00 2001 From: akashnimare Date: Fri, 22 Dec 2017 17:21:08 +0530 Subject: [PATCH] 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. --- zerver/fixtures/markdown_test_cases.json | 6 ++++++ zerver/lib/bugdown/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/zerver/fixtures/markdown_test_cases.json b/zerver/fixtures/markdown_test_cases.json index 92c046d1f1..afb41d537c 100644 --- a/zerver/fixtures/markdown_test_cases.json +++ b/zerver/fixtures/markdown_test_cases.json @@ -188,6 +188,12 @@ "expected_output": "

I like software love hardware

", "text_content": "I like software love hardware" }, + { + "name": "strikthrough_link", + "input": "~~test http://xx.xx link~~", + "expected_output": "

test http://xx.xx link

", + "text_content": "test http://xx.xx link" + }, { "name": "underscore_disabled", "input": "_foo_", diff --git a/zerver/lib/bugdown/__init__.py b/zerver/lib/bugdown/__init__.py index ccb8866d85..0b9cca504c 100644 --- a/zerver/lib/bugdown/__init__.py +++ b/zerver/lib/bugdown/__init__.py @@ -1395,7 +1395,7 @@ class Bugdown(markdown.Extension): # Custom strikethrough syntax: ~~foo~~ md.inlinePatterns.add('del', markdown.inlinepatterns.SimpleTagPattern( - r'(?strong') + r'(?strong') # Text inside ** must start and end with a word character # it need for things like "const char *x = (char *)y"