Comments (10)
I'm not quite sure why it is broken like this but this page is not supposed to be visited in the first place, it was changed to be this way: https://leanprover-community.github.io/mathlib4_docs/find/?pattern=Lean.Meta.abstractMVars#doc
from doc-gen4.
I think it's broken that way due to use of relative URLs in iframes. If you use absolute urls the issue should go away.
from doc-gen4.
I'm not quite sure how to make the URLs absolute from a conceptual point of view. The idea with the relative URLs in doc-gen4 was to make it so that anyone can put the generated HTML at any sub URL with any prefix (including none) seamlessly. How could we preserve that without relative URLs?
from doc-gen4.
I don't think you can solve that. When generating the HTML for the 404 page I think the user needs to specify the folder that the site is hosted from.
If you do that, then you can probably get away with just putting <base href="/$SUB_URL" />
in the 404 page, and leave the rest alone. This seems pretty reasonable, given that 404 pages aren't a standard thing anyway, and doc-gen4 presumably assumes github which probably only serves them from the root directory anyway.
from doc-gen4.
This https://leanprover-community.github.io/mathlib4_docs/find/?pattern=ohno works. Is there a way to add HTML/javascript code to that page to convert malfotmed https://leanprover-community.github.io/mathlib4_docs/find/ohno to this form?
from doc-gen4.
The issue here is Github Pages AFAICT. I already elaborated this a bit on Zulip but I can repeat what's going on here:
doc-gen already generates a 404.html page that is hosted on Github Pages. That 404.html page heavily relies on being called precisely with /404.html
due to relative paths (e.g. it links to style.css
at ./style.css
. The reason for this relative linking is that doc-gen's pages are supposed to be hostable behind arbitrary prefixes without requiring any intervention from the user.
What happens now is the following:
- In the
find/?pattern
case the JS of find.html notices that it can't find something and does an explicit redirect to/404.html
. This makes everything get rendered fine. - In the
/find/ohno
case, Github Pages decides "aha, I don't have a file that I can present here, I shall instead present 404.html" But it does not perform a redirect to 404.html, instead it just presents the file at this specific path. It will then look for./style.css
(and other files), not find anything and get horribly broken in the way that we see it.
I currently don't really see a nice fix for this, if someone knows a way to make this redirect ourselves or convince Github pages to do it for us I would happily add it.
from doc-gen4.
Maybe it's better to provide another separate 404 page using absolute path? In fact currently any misspelled page will result in broken 404 page, e.g. https://leanprover-community.github.io/mathlib4_docs/Mathlib/FieldTheory/IntermediateField5.html
from doc-gen4.
The reason for this relative linking is that doc-gen's pages are supposed to be hostable behind arbitrary prefixes without requiring any intervention from the user.
I think the thing to do is allow the user to specify a SITE_ROOT
that defaults to .
(ie the current behavior). In the build for github actions for mathlib, we can use SITE_ROOT=/
from doc-gen4.
The reason for this relative linking is that doc-gen's pages are supposed to be hostable behind arbitrary prefixes without requiring any intervention from the user.
I think the thing to do is allow the user to specify a
SITE_ROOT
that defaults to.
(ie the current behavior). In the build for github actions for mathlib, we can useSITE_ROOT=/
This is the wrong site root though :P the correct one would be /mathlib4_docs/
. It used to be the case that doc-gen had this feature but I removed it because people were using it wrongly and got confused. I can get behind the idea of adding an option that is .
by default. But this is just a workaround. The proper fix should be to configure whatever webserver you are running such that this works :/
from doc-gen4.
2. But it does not perform a redirect to 404.html
This is a feature; performing a redirect would amount to serving up a 30x status code, which would not be the 404 status code that is meant to happen.
from doc-gen4.
Related Issues (20)
- important type info is omitted HOT 3
- error: no such file or directory HOT 4
- ERROR: could not execute external process 'cc' HOT 2
- @[reducible] attributes are not shown HOT 1
- Hyperlinking not working when an up-arrow occurs before the declaration name
- Implement references / bibliography HOT 7
- Unclear error when running in a git repo without "origin" remote HOT 1
- Lean statement not rendered for theorems defined as `def thm : Prop := statement`
- Improve UX for long instance names HOT 1
- instances for vs instances mentioning
- Show data fields only to avoid "not rendered due to size" HOT 1
- Put inductive/structure documentation before field documentation HOT 3
- Auto-generated lemmas appear before declaration HOT 1
- De-indent comment block HOT 3
- Empty instances for HOT 1
- Escape sequences are handled incorrectly in LaTeX HOT 9
- Support for protected modifier
- auto-generated structure projections not appearing HOT 2
- noncomputable section isn't shown anywhere HOT 2
- Clicking links in the navbar or using the "Go to source" link produces an error in VS Code webviews
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from doc-gen4.