Skip to content

Commit 27a739d

Browse files
holoviz-mcp url_transform
1 parent 545e38c commit 27a739d

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

src/holoviz_mcp/docs_mcp/data.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ def convert_path_to_url(path: Path, remove_first_part: bool = True, url_transfor
195195
path_obj = Path(url_path)
196196
if url_transform == "plotly":
197197
url_path = str(path_obj.with_suffix(suffix="")) + "/"
198+
if url_path.endswith("index/"):
199+
url_path = url_path[: -len("index/")] + "/"
198200
else:
199201
url_path = str(path_obj.with_suffix(suffix=".html"))
200202

tests/docs_mcp/test_data.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ def test_convert_path_to_url_plotly():
3434
assert url == "doc/python/3d-axes/"
3535

3636

37+
def test_convert_index_path_to_url_plotly():
38+
url = convert_path_to_url(Path("docs/index.md"), url_transform="plotly")
39+
assert url == "/"
40+
41+
3742
def test_convert_path_to_url_datashader():
3843
url = convert_path_to_url(Path("/examples/user_guide/10_Performance.ipynb"), url_transform="datashader")
3944
assert url == "examples/user_guide/Performance.html"

0 commit comments

Comments
 (0)