-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
src/node/markdownToVue.ts
Outdated
if (!pages.includes(resolved)) { | ||
if ( | ||
!pages.includes(resolved) && | ||
!fs.existsSync(path.resolve(dir, 'public', `${resolved}.html`)) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
vitepress/src/node/build/bundle.ts
Line 83 in 77f144a
build(resolveViteConfig(false)), |
vitepress/src/node/markdownToVue.ts
Line 20 in 77f144a
export function createMarkdownToVueRenderFn( |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
@antfu Hello, is there any problem with this PR? Can it be merged? |
For example:
It will check dead link automatically.
[test](/test.html)
needdocs/test.md
, otherwise it will fail to build.But we also can place
test.html
indocs/public
,docs/public/test.html
.So we can add a rule for it. Just check it too.