Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation regarding anchor links #4193

Closed
wants to merge 1 commit into from

Conversation

bjoernmartin
Copy link

Working with vitepress v1.3.3, I noticed a link in the format ./#heading does not work / leads to a docs generation error, whereas #heading works for me. Hence this PR.

Description

Linked Issues

Additional Context


Tip

The author of this PR can publish a preview release by commenting /publish below.

Working with vitepress v1.3.3, I noticed a link in the format `./#heading` does not work / leads to a docs generation error, whereas `#heading` works for me. Hence this PR.
@github-actions github-actions bot added the stale label Oct 12, 2024
@brc-dd
Copy link
Member

brc-dd commented Oct 12, 2024

read the sentence again, it's to go to foo/index.md#heading from foo/one.md

what you've written is how you jump to different header within the same file

@brc-dd brc-dd closed this Oct 12, 2024
@bjoernmartin
Copy link
Author

It still fixed working with Vitepress for me, so no idea how your explanation invalidates that. But who am I to force you accepting help?

@brc-dd
Copy link
Member

brc-dd commented Oct 12, 2024

That section reads:

For example, given the following directory structure:

```
.
├─ index.md
├─ foo
│  ├─ index.md
│  ├─ one.md
│  └─ two.md
└─ bar
   ├─ index.md
   ├─ three.md
   └─ four.md
```

And providing you are in `foo/one.md`:

...

[foo heading](./#heading) <!-- anchors user to a heading in the foo index file -->

So, if you make it

[foo heading](#heading)

It will go to /foo/one.html#heading not /foo/#heading

The original version might have caused issue for you because you might not have a foo/index.md in first place. So, trying to link to it rightfully threw dead link found error.

image

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants