Skip to content

Commit fb18958

Browse files
committed
refactor: Add YouTube link handling for Nexus BBCode format in Markdown to BBCode conversion
1 parent 55c2aaa commit fb18958

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

markdown_to_bbcode.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ def replace_links(match):
118118
if bbcode_type == 'steam' and 'youtube.com/watch?v=' in link_url:
119119
video_id = re.search(r'v=([^&]+)', link_url).group(1)
120120
return f"[previewyoutube={video_id};full][/previewyoutube]"
121+
elif bbcode_type == 'nexus' and 'youtube.com/watch?v=' in link_url:
122+
video_id = re.search(r'v=([^&]+)', link_url).group(1)
123+
return f"[youtube]{video_id}[/youtube]"
121124
elif repo_name and not re.match(r'^https?://', link_url):
122125
absolute_url = f"https://github.com/{repo_name}/raw/main/{relative_path}/{link_url}"
123126
return f"[url={absolute_url}]{link_text}[/url]"

0 commit comments

Comments
 (0)