INNER CODE UNIT · Python
convert_md_link
sameerasw/essentials · .github/scripts/clean_release_notes.py:21
def convert_md_link(match):
return f'<a href="{match.group(2)}">{match.group(1)}</a>'
text = re.sub(r"\[(.*?)\]\((.*?)\)", convert_md_link, text)
text = re.sub(r"\*\*(.*?)\*\*", r"<b>\1</b>", text)
cleaned_lines = []
in_quote = False
quote_buf = []
for line in text.splitlines():
trimmed = line.lstrip()
if trimmed.startswith(">"):
content = trimmed[1:].strip()
if content:
quote_buf.append(content)
in_quote = True
continue