Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions slackdown/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'<a href="\g<1>" target="blank">\g<2></a>', txt)
txt = re.sub(r'<([^\|]*?)\|([^\|]*?)>', r'<a href="\g<1>" target="blank">\g<2></a>', txt)

# handle unnamed hyperlinks
txt = re.sub(r'<([^a|/a].*)>', r'<a href="\g<1>" target="blank">\g<1></a>', txt)
txt = re.sub(r'<([^a|/a].*?)>', r'<a href="\g<1>" target="blank">\g<1></a>', txt)

# handle ordered and unordered lists
for delimeter in LIST_DELIMITERS:
Expand Down