-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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: Cannot serve off /.../index.html
#1372
fix: Cannot serve off /.../index.html
#1372
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/docsify-core/docsify-preview/1nszbjtkr |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit d94d259:
|
The e2e tests are reported by CI as failing, but are passing locally for me. |
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 a lot for fixing the bug.
It does seems to work and fixes the issue.
Few questions
- It would be great to have some more test cases.
- it would be great to have some comments for why we are doing those normalizing and those conditional check. May be linking to the issues/PR will work as well.
Also, I doubt this might be a semver-major as it can be a breaking change. cc @docsifyjs/reviewers
@anikethsaha Thanks for the feedback. Could you clarify what sort of test cases you are looking for? I notice you have Cypress and unit tests. Which would you prefer, and where would they go exactly? |
You could add cypress tests for other links like
Also if there are other cases you think you can add |
Done, let me know if they're sufficient. |
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.
LGTM 🎉
My only concern is whether this should be considered as breaking or not!
It shouldn't be breaking, it's an additive change. You could argue that any breakages would be bugs. |
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.
@anikethsaha I think when it is not sure if it is a breaking change, we can make it as an option.
Giving the switch button
to users' hands.:)
Hmmm I think this change breaks live reloads in development mode. |
I agree that it is not a breaking change as it was a bug so probably it wasn't used before in order to avoid the bug. |
Been trying to add a feature flag for this, but the code is getting very complicated. If this isn't a breaking change, can we live without it? |
cc @docsifyjs/core |
Hey @rgladwell, Thanks for the PR! We recently merged #1276 into |
c375219
to
d7cae0e
Compare
Is there some way to get a screenshot or run non-headless for the Jest e2e tests? |
Docsify must be hosted on a server that supports a default directory index (i.e. maps `/.../` -> `/.../index.html`). Some platforms do not support this, however. For example, HTML apps hosted on the popular game/software platform, Itch.io. This change supports hosting Docsify off an explicit path file, such as `/index.html`. It does this by: 1. Adding handling for paths like `index.html#/blah`, and 2. Normalising paths with fragments back to markdown paths For example, `http://example.org/index.html#/blah` would be mapped to `http://example.org/blah.md`. This fixes: docsifyjs#427
@jhildenbiddle @anikethsaha @Koooooo-7 As requested, added e2e tests using Jest framework. |
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.
LGTM.
note: Please use squash and merge
for merging
/.../index.html
/.../index.html
Thanks! |
Summary
fixes #427
Docsify must be hosted on a server that supports a default directory index (i.e. maps
/.../
->/.../index.html
).Some platforms do not support this, however. For example, HTML apps hosted on the popular game/software platform, Itch.io.
This change supports hosting Docsify off an explicit path file, such as
/index.html
. It does this by:/index.html
part of the path being removed during routing, andFor example,
http://example.org/index.html#/blah
would be mapped to the markdown source filehttp://example.org/blah.md
.This fixes:
#427
What kind of change does this PR introduce? (check at least one)
If changing the UI of default theme, please provide the before/after screenshot:
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
fix #xxx[,#xxx]
, where "xxx" is the issue number)You have tested in the following browsers: (Providing a detailed version will be better.)
If adding a new feature, the PR's description includes:
To avoid wasting your time, it's best to open a feature request issue first and wait for approval before working on it.