-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Book 2nd edition is broken on stable and beta #44704
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
Comments
We could also remove the line that was added in https://github.com/rust-lang/book/pull/783/files from all the HTML files for the book for all the versions...... which is arguably "more correct", but also more work. |
@steveklabnik have you confirmed that adding the store.js file to a book built with mdbook 0.22 fixes the styling? |
That is modifying the code we released, which is against immutable releases, which I am pretty against.
I am doing so right now. |
Okay, so this is strange.
However.... if I do use More investigation is apparently needed. |
Every version ever published with mdbook now looks broken https://doc.rust-lang.org/1.17.0/book/ I remember checking this before release; there's no way that the book has been broken for three releases and nobody has noticed. |
cc @rust-lang/infra |
(@ashleygwilliams and I are debugging this right now) |
So, @ashleygwilliams figured it out:
Yes, there are extra quotes in there. However, they're not in view-source, only in the final output. This makes me suspect JavaScript. But it's still extremely suspicious that not one person noticed this, not sure why this is happening. |
if you change the theme, the error disappears. so that's a quick fix to offer people. taking a look at the old javascript to see if i can discern what's up. |
Okay! We think we've got it. mdbook stores the current theme in localstorage. This did change in newer/older mdbook, but it looks like this, basically:
However, if you visit the nightly docs, and run this in your JS console:
See the quotes? If you go back to stable docs, and delete the theme from localstorage, and then refresh, it works, and
So: TL;DR: this is an mdBook bug. It only manifests if you read the nightly docs, then go back and look at the stable docs. So, the solution is, fix the bug in mdBook, update, and backport to beta. |
Correction: only nightly needs to be fixed; it's what's poisoning localstorage. No need to update the Whew! This bug was nasty. |
😱🙀😱🙀😱🙀😱🙀 |
Was this resolved upstream with https://github.com/azerupi/mdBook/pull/449 ? If so, is the next step here just an mdbook bump? |
Yes, we need an mdbook release and then bump the version here. |
To my understanding this fix has prevented new cases of corrupted local storage from being created, but does not help the existing cases. From what I gather, localStorage never expires, so users who do not regularly clear their data may remain affected for arbitrarily long. |
@steveklabnik I confirm. But I chose the same theme (Light) and the styles were restored immediately. |
Yeah, any theme choice should do it. Thanks for the clarification :) |
If this bug affects you, please see the workaround here: #44704 (comment)
The current stable and beta docs are missing a single javascript file,
store.js
.Stable rust builds with
mdbook=0.0.22
In0.0.23
,mdbook
introduced a new javascript file,store.js
. The Book second edition uses a custom template in order to display the "this is a draft" banner, and so, we updated it to include the new file rust-lang/book#783. However, this was wrong; it shouldn't have been done untilmdbook
was updated in the main repository. As such, things are now very broken:As nightly has updated
mdbook
, this has been fixed, but having the main way of learning Rust broken for ~10 weeks isn't great.For stable
We could fix the online docs by just uploading
store.js
to the appropriate place. I am normally very against changing what we distribute after the fact, but simply adding a file seems very minimal.While this regression is in some sense very serious, I don't think it's worth cutting a new stable for, with this workaround.
For beta
In my opinion, we should send in a backport fix to beta. This involves upgrading mdbook on beta.
Tagging as "regression from stable to nightly" even though it's been fixed in nightly; this is about what to do for stable and beta. Tagging @rust-lang/infra for the stable fix, tagging @rust-lang/docs for the beta fix.
The text was updated successfully, but these errors were encountered: