fix typst images

This commit is contained in:
anarsec 2024-04-15 13:41:17 +00:00
parent 5d9796b043
commit d10f774921
No known key found for this signature in database
4 changed files with 9 additions and 2 deletions

View file

@ -127,6 +127,10 @@ class Converter:
recommendations = re.search(r'\+{3}.*?\+{3}(.*)', recommendations_file.open().read(), re.MULTILINE | re.DOTALL).group(1)
markdown_content += f"\n\n# Recommendations\n\n{recommendations}\n\n"
# Make all images paths relative in the Markdown content
for extension in ["jpg", "png", "webp", "jpeg"]:
markdown_content = re.sub(f'\\(\\/posts/{input_path.parent.name}/(.*?\.{extension})\\)', lambda match: f'({match.group(1)})', markdown_content)
# Replace all .webp images to .png images in the Markdown content
markdown_content = re.sub(r'\((.*?\.webp)\)', lambda match: f'({match.group(1)}.png)', markdown_content)