Plaintext negative lookbehind scan (#14601)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
80e311a07e
commit
22a44d82c5
1 changed files with 1 additions and 1 deletions
|
|
@ -193,7 +193,7 @@ def convert_plaintext_links_to_html(content):
|
|||
for text_node in paragraph.find_all(string=True, recursive=False):
|
||||
if text_node.parent.name not in {"a", "code"}: # Ignore links and code blocks
|
||||
new_text = re.sub(
|
||||
r'(https?://[^\s\'")]+)(?=[,.!?;:]?(?:\s|$)|[\'")])',
|
||||
r'(https?://[^\s()<>]+(?:\.[^\s()<>]+)+)(?<![.,:;\'"])',
|
||||
r'<a href="\1">\1</a>',
|
||||
str(text_node),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue