diff --git a/src/kbmate_cli/image_helper.py b/src/kbmate_cli/image_helper.py index c3cb984..d4d808d 100644 --- a/src/kbmate_cli/image_helper.py +++ b/src/kbmate_cli/image_helper.py @@ -28,7 +28,7 @@ def extract_and_relink_images(markdown: str, src_dir: str, dst_dir: str) -> str: dst_file = dst_path / new_name shutil.move(str(src_file), str(dst_file)) old_ref = match.group(0) - new_ref = f"![](/assets/{dst_path.name}/{new_name})" + new_ref = f"![](assets/{dst_path.name}/{new_name})" result = result.replace(old_ref, new_ref, 1) counter += 1 diff --git a/tests/test_image_helper.py b/tests/test_image_helper.py index dc27410..840918d 100644 --- a/tests/test_image_helper.py +++ b/tests/test_image_helper.py @@ -33,6 +33,6 @@ def test_extract_and_relink_images(): assert (dst_dir / "image-001.png").exists() assert (dst_dir / "image-002.png").exists() - assert "/image-001.png" in result - assert "/image-002.png" in result + assert "![](assets/test_relink_dst/image-001.png)" in result + assert "![](assets/test_relink_dst/image-002.png)" in result assert "doc-0001-01" not in result