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: detect public folder for dead link #290

Merged
merged 2 commits into from
May 27, 2021
Merged

Conversation

YunYouJun
Copy link
Contributor

For example:

[test](/test.html)

It will check dead link automatically. [test](/test.html) need docs/test.md, otherwise it will fail to build.

But we also can place test.html in docs/public, docs/public/test.html.
So we can add a rule for it. Just check it too.

path.resolve(dir, 'public', `${resolved}.html`)

if (!pages.includes(resolved)) {
if (
!pages.includes(resolved) &&
!fs.existsSync(path.resolve(dir, 'public', `${resolved}.html`))
Copy link
Member

@antfu antfu Apr 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to use config.publicDir

https://vitejs.dev/config/#publicdir

Copy link
Contributor Author

@YunYouJun YunYouJun Apr 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, thanks. But i can not find how to use vite config in vitepress.
Can you give me a hint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How can i get resolvedViteConfig in markdownToVue.ts?
It seems that there is not a global configuration exported.
Should there be a better solution to get some global configuration in the function?

build(resolveViteConfig(false)),

export function createMarkdownToVueRenderFn(

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get it using https://vitejs.dev/guide/api-plugin.html#configresolved in plugin.ts and pass it over

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I submitted a new commit that uses config.publicDir instead of the 'public' string.

@YunYouJun
Copy link
Contributor Author

@antfu Hello, is there any problem with this PR? Can it be merged?

@antfu antfu merged commit 3aa185f into vuejs:master May 27, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants