From 426e7bee17f85994ec30c805a801ad43c7df3cc7 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Fri, 23 May 2025 07:19:27 -0700 Subject: [PATCH] Fix loading of mode-rust.js The reason the ACE editor was failing to load the rust syntax highlighting is because the syntax highlighting was being created *after* the editor was created. If the editor is created first, then ACE tries to load `ace/mode/rust`. Since it isn't already defined, it tried to compute the URL and load it manually. However, since the URLs now have a hash in it (via https://github.com/rust-lang/mdBook/pull/1368), it was unable to load. The solution here is to make sure `ace/mode/rust` is defined before creating the editors. Then ACE knows that it can just load the module directly instead of trying to fetch it from the server. Fixes https://github.com/rust-lang/mdBook/issues/2700 --- src/front-end/templates/index.hbs | 2 +- tests/gui/move-between-pages.goml | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/front-end/templates/index.hbs b/src/front-end/templates/index.hbs index aeae9a843f..d30be2741d 100644 --- a/src/front-end/templates/index.hbs +++ b/src/front-end/templates/index.hbs @@ -297,8 +297,8 @@ {{#if playground_js}} - + {{/if}} diff --git a/tests/gui/move-between-pages.goml b/tests/gui/move-between-pages.goml index 2c70730029..c707ef7314 100644 --- a/tests/gui/move-between-pages.goml +++ b/tests/gui/move-between-pages.goml @@ -1,8 +1,5 @@ // This tests pressing the left and right arrows moving to previous and next page. -// We disable the requests checks because `mode-rust.js` is not found. -fail-on-request-error: false - go-to: |DOC_PATH| + "index.html" // default page is the first numbered page