Skip to content

Commit dd4b8e3

Browse files
committed
fix: Enhance YouTube link handling in BBCode conversion for Nexus and Steam formats
1 parent fb18958 commit dd4b8e3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

markdown_to_bbcode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,10 @@ def replace_links(match):
117117
link_text, link_url = match.groups()
118118
if bbcode_type == 'steam' and 'youtube.com/watch?v=' in link_url:
119119
video_id = re.search(r'v=([^&]+)', link_url).group(1)
120-
return f"[previewyoutube={video_id};full][/previewyoutube]"
120+
return f"{link_text}\n[previewyoutube={video_id};full][/previewyoutube]"
121121
elif bbcode_type == 'nexus' and 'youtube.com/watch?v=' in link_url:
122122
video_id = re.search(r'v=([^&]+)', link_url).group(1)
123-
return f"[youtube]{video_id}[/youtube]"
123+
return f"{link_text}\n[youtube]{video_id}[/youtube]"
124124
elif repo_name and not re.match(r'^https?://', link_url):
125125
absolute_url = f"https://github.com/{repo_name}/raw/main/{relative_path}/{link_url}"
126126
return f"[url={absolute_url}]{link_text}[/url]"

0 commit comments

Comments
 (0)