-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
test(v2): add protocol relative uri validation test #3453
Conversation
Deploy preview for docusaurus-2 ready! Built with commit 0f65fd2 |
41f09d9
to
8cb594f
Compare
I've run into a similar issue already - I believe your issue will be solved by #3449 which is a more permissive implementation (will allow relative URIs such as If you could take a look, I'm happy to merge in the unit tests for your case. |
@tommilligan |
For your case, why not use |
The reason for a full reload is I'm linking to an external, but relative path. In my case I'm linking from say, A full reload is required, otherwise docusaurus simply interprets the relative link as requiring a To force the full reload, I set |
Its looks like try type in your cli npx docusaurus swizzle @docusaurus/theme-classic Navbar and modify your own navbar if your pull request not been approval. In my mind its should not a common way. for offical document: https://v2.docusaurus.io/docs/cli/#docusaurus-swizzle |
@moonrailgun actually, I've just tried setting both Thanks for your help! |
# Conflicts: # packages/docusaurus-utils-validation/src/__tests__/validationSchemas.test.ts
Thanks, Actually updated the PR but kept the test cases, because @tommilligan is right, // is included in the {relativeUri: true} option (that I merged). |
BTW, it's worth nothing that relative protocol uris are considered an antipattern according to https://www.paulirish.com/2010/the-protocol-relative-url/ |
This is a confusing part of this project, and is historically like this. Will try to improve that but it's not so easy to make changes without annoying users with breaking changes unfortunately |
@slorber Well, i just consider about should simple text should identified as a uri? like Maybe i am too prudent. |
Motivation
I Wanna Support relative url like
//docusaurus.io
in footer link item inhref
fieldHave you read the Contributing Guidelines on pull requests?
Yep
Test Plan
I append a test case for relative url in URISchema test case
or manual modify
themeConfig-footer-links-items-href
field start with//
(nothttp://
orhttps://
)Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)