From 38e16ebfac3ef4b499354ec11133aba02893a2b5 Mon Sep 17 00:00:00 2001 From: Michael Ding Date: Thu, 28 May 2026 11:17:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20markdown=20=E5=9B=BE=E7=89=87=E5=BC=95?= =?UTF-8?q?=E7=94=A8=E8=B7=AF=E5=BE=84=E6=94=B9=E4=B8=BA=E7=9B=B8=E5=AF=B9?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=20assets/=20=E8=80=8C=E9=9D=9E=20/assets/?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/kbmate_cli/image_helper.py | 2 +- tests/test_image_helper.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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