-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Support filename that contains non-ASCII and unicode chars #473
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
526e454
feat: use random hash string as component name
ulivz 84e74bd
fix: unexpected 404 when hit browser back button
ulivz 4b9a2f3
chore: add temporary test MDs
ulivz b142e11
chore: clean log
ulivz 2ac841d
chore: tweaks
ulivz ea27b2e
chore: remove fixing 404 of hit back button
ulivz 05cb65a
chore: clean code
ulivz 613ea7f
chore: simplify code
ulivz 9e7a3dc
feat: perfect solution to support non-ASCII file name
ulivz 5109d28
Merge branch 'master' into support-non-ascii-filename
ulivz 953c76c
fix: merge conflict
ulivz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 尤 | ||
|
||
- [雨](./雨.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 溪 | ||
|
||
- [Homepage](./) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 雨 | ||
|
||
- [溪](./溪.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
如果 filepath 包含
!
号,如:/docs/hello!.md
,因为使用了 Webpack,!
前面的内容会被认为是 loader 的配置,见:https://webpack.js.org/concepts/loaders/#inline。在我的 PR 中,我使用了 webpack-virtual-modules 解决了这个问题。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.
Since webpack does not support the path containing
!
and even throw error for that: webpack/webpack#6754 .So we don't need to introduce
webpack-virtual-modules
to support!
which should be handled by webpack instead of VuePress.We don't need to introduce a huge hack to cater to it for an illegal use case.
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.
哈哈,补充下我的思路。
文件:
/docs/hello!.md
我们可以在 VuePress 里读取
hello!.md
的内容,并用它生成一个与hello!.md
同级的 virtual module,比如:docs/page-1.md
,然后import('docs/page-1.md')
,如此即可避免!
的问题,同时因为是同级目录,原文件里的路径都不用改变。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.
我用中文重申一下:我们没有必要为了一个并不合法的极少数用例来引入庞大的代码hack。
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.
好吧,我想
!
仅仅是对于Webpack
不合法。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.
既然 VuePress 基于 Webpack,本着职责清晰的原则,我们不应该在 VuePress 中来解决 Webpack 的问题,万一哪天 Webpack 有自己的解决方案呢?此外,你这种解决方案太复杂了。
如果你需要这个 feature,请给 Webpack 提 Issue 或者 PR,谢谢。