Fix regex for URL and image URL formatting
This commit is contained in:
parent
90be900448
commit
5d683da38f
@ -233,11 +233,11 @@ class SlackChannel(BaseChannel):
|
||||
# Convert URL formatting
|
||||
# Step 6: [text](URL) -> <URL|text>
|
||||
converted_text = re.sub(
|
||||
r"(^|[^!])\[(.+?)\]\((http.+?)\)", r"<\2|\1>", converted_text)
|
||||
r"(^|[^!])\[(.+?)\]\((http.+?)\)", r"\1<\3|\2>", converted_text)
|
||||
# Convert image URL
|
||||
# Step 6:  -> <URL>
|
||||
converted_text = re.sub(
|
||||
r"[!]\[.+?\]\((http.+?)(?: \".*?\")?\)", r"<\2>", converted_text)
|
||||
r"[!]\[.+?\]\((http.+?)(?: \".*?\")?\)", r"<\1>", converted_text)
|
||||
return converted_text
|
||||
def escape_mrkdwn(text: str) -> str:
|
||||
return (text.replace('&', '&')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user