Skip to content

Commit 16e0abc

Browse files
authored
Merge pull request #20 from Szwendacz99/fixes
better markdown urls matching for replace
2 parents 0a03305 + 6e80b64 commit 16e0abc

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

exporter.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,15 +458,14 @@ def update_markdown_image_tags(doc: Node, data: bytes) -> bytes:
458458
# try preventing replacing host url in other paces
459459
dir_fallback_md = ']('
460460
dir_fallback_md += '../' * levels
461-
dir_fallback_md += args.images_dir
461+
dir_fallback_md += args.images_dir + "/uploads/images/"
462462
dir_fallback_html = '<img src="'
463463
dir_fallback_html += '../' * levels
464-
dir_fallback_html += args.images_dir
464+
dir_fallback_html += args.images_dir + "/uploads/images/"
465465

466466
host = removesuffix(args.host, '/')
467-
data = data.replace(f']({host}'.encode(), dir_fallback_md.encode())
468-
data = data.replace(f'<img src="{host}'.encode(), dir_fallback_html.encode())
469-
print("md images")
467+
data = data.replace(f']({host}/uploads/images/'.encode(), dir_fallback_md.encode())
468+
data = data.replace(f'<img src="{host}/uploads/images/'.encode(), dir_fallback_html.encode())
470469
data_str = re.sub(r'/scaled-\d+-/', r'/', data.decode())
471470
return data_str.encode()
472471

0 commit comments

Comments
 (0)