mirror of
https://github.com/MathiasDPX/blog.git
synced 2025-05-10 07:33:09 +00:00
add url to formatContent
This commit is contained in:
parent
f36033d841
commit
1bc6d09835
1 changed files with 10 additions and 2 deletions
|
@ -34,10 +34,18 @@ def convert_slack_references(text):
|
|||
def channel_replacement(match):
|
||||
channel_id = match.group(1)
|
||||
channel_name = channels_maps.get(channel_id, channel_id)
|
||||
return f'<a target="_blank" href="https://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'<(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-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)
|
||||
|
||||
return result
|
||||
|
||||
@sp_routes.route("/scrapbook")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue