Skip to content

Commit c833958

Browse files
KyleAMathewsclaude
andcommitted
fix: also handle bare relative paths in markdown links
Extends the normalization to handle paths like "guides/foo.md" (without ./) that should be treated as sibling directories. This ensures compatibility with various markdown link styles used in documentation. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 20fb82d commit c833958

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

.claude/settings.local.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(sed:*)",
5+
"Bash(npx prettier:*)",
6+
"WebFetch(domain:github.com)",
7+
"Read(//Users/kylemathews/programs/tanstack-db/docs/**)",
8+
"WebFetch(domain:deploy-preview-477--tanstack.netlify.app)"
9+
],
10+
"deny": [],
11+
"additionalDirectories": [
12+
"/Users/kylemathews/programs/tanstack-db/docs/guides"
13+
]
14+
}
15+
}

src/components/MarkdownLink.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export function MarkdownLink({
2323
if (to?.startsWith('./')) {
2424
// Convert ./path to ../path to account for the fact that we're at /docs/file not /docs/file/
2525
to = '../' + to.slice(2)
26+
} else if (to && !to.startsWith('/') && !to.startsWith('../') && to.includes('/')) {
27+
// Handle bare relative paths like "guides/foo" that should be treated as "../guides/foo"
28+
// This handles cases where markdown has "subfolder/file.md" instead of "./subfolder/file.md"
29+
to = '../' + to
2630
}
2731

2832
return (

0 commit comments

Comments
 (0)