From a5f21f72d5cb4e2a69998122c8d990607e5ed640 Mon Sep 17 00:00:00 2001 From: Lin Date: Thu, 18 Jul 2019 13:30:16 -0700 Subject: [PATCH] Fix broken url support --- slackdown/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/slackdown/__init__.py b/slackdown/__init__.py index 517ee08..54b110b 100644 --- a/slackdown/__init__.py +++ b/slackdown/__init__.py @@ -62,16 +62,16 @@ def render(txt): """ # Removing links to other channels - txt = re.sub(r'<#[^\|]*\|(.*)>', r'#\g<1>', txt) + txt = re.sub(r'<#[^\|]*?\|(.*?)>', r'#\g<1>', txt) # Removing links to other users - txt = re.sub(r'<(@.*)>', r'\g<1>', txt) + txt = re.sub(r'<(@.*?)>', r'\g<1>', txt) # handle named hyperlinks - txt = re.sub(r'<([^\|]*)\|([^\|]*)>', r'\g<2>', txt) + txt = re.sub(r'<([^\|]*?)\|([^\|]*?)>', r'\g<2>', txt) # handle unnamed hyperlinks - txt = re.sub(r'<([^a|/a].*)>', r'\g<1>', txt) + txt = re.sub(r'<([^a|/a].*?)>', r'\g<1>', txt) # handle ordered and unordered lists for delimeter in LIST_DELIMITERS: