mirror of
https://github.com/MathiasDPX/blog.git
synced 2025-05-10 15:43:09 +00:00
Fix link interpreted as tag
This commit is contained in:
parent
74b6aac922
commit
4a8e87142b
1 changed files with 7 additions and 1 deletions
|
@ -36,7 +36,13 @@ def convert_slack_references(text):
|
||||||
channel_name = channels_maps.get(channel_id, channel_id)
|
channel_name = channels_maps.get(channel_id, channel_id)
|
||||||
return f'<a target="_blank" href="htps://hackclub.slack.com/archives/{channel_id}">#{channel_name}</a>'
|
return f'<a target="_blank" href="htps://hackclub.slack.com/archives/{channel_id}">#{channel_name}</a>'
|
||||||
|
|
||||||
result = re.sub(channel_pattern, channel_replacement, text)
|
url_pattern = r'<(http(?:|s):\/\/[a-zA-Z0-9\.\/_-]+)>'
|
||||||
|
def url_replacement(match):
|
||||||
|
url = match.group(1)
|
||||||
|
return f'<a target="_blank" href="{url}">{url}</a>'
|
||||||
|
|
||||||
|
result = re.sub(url_pattern, url_replacement, text)
|
||||||
|
result = re.sub(channel_pattern, channel_replacement, result)
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue