Commit Graph

2673 Commits

Author SHA1 Message Date
Eric Huss
f93b2675ff Merge pull request #2714 from ehuss/bump-version
Update to 0.4.51
v0.4.51
2025-05-26 18:23:28 +00:00
Eric Huss
365918bf89 Merge pull request #2713 from ehuss/fix-s-key
Fix search hotkey
2025-05-26 18:04:46 +00:00
Eric Huss
76be253f76 Update to 0.4.51 2025-05-26 11:01:12 -07:00
Eric Huss
0210e69abc Fix search hotkey
https://github.com/rust-lang/mdBook/pull/2608 accidentally broke the
search "S" keybinding by using the wrong capitalization.
2025-05-26 10:58:53 -07:00
Eric Huss
cdbf6d2806 Merge pull request #2712 from ehuss/bump-version
Update to 0.4.50
v0.4.50
2025-05-23 15:04:07 +00:00
Eric Huss
902ded9f89 Merge pull request #2711 from ehuss/update-dependencies
Update dependencies
2025-05-23 15:01:40 +00:00
Eric Huss
851932bd4b Update to 0.4.50 2025-05-23 07:57:51 -07:00
Eric Huss
f38dc687e3 Update dependencies
Also bump MSRV to 1.82

Updating anstyle-wincon v3.0.7 -> v3.0.8
Updating backtrace v0.3.74 -> v0.3.75
Updating bitflags v2.9.0 -> v2.9.1
Updating cc v1.2.21 -> v1.2.24
Updating clap v4.5.37 -> v4.5.38
Updating clap_builder v4.5.37 -> v4.5.38
Updating clap_complete v4.5.48 -> v4.5.50
Updating errno v0.3.11 -> v0.3.12
Updating getrandom v0.3.2 -> v0.3.3
Updating icu_collections v1.5.0 -> v2.0.0
Adding icu_locale_core v2.0.0
Removing icu_locid v1.5.0
Removing icu_locid_transform v1.5.0
Removing icu_locid_transform_data v1.5.1
Updating icu_normalizer v1.5.0 -> v2.0.0
Updating icu_normalizer_data v1.5.1 -> v2.0.0
Updating icu_properties v1.5.1 -> v2.0.1
Updating icu_properties_data v1.5.1 -> v2.0.1
Updating icu_provider v1.5.0 -> v2.0.0
Removing icu_provider_macros v1.5.0
Updating idna_adapter v1.2.0 -> v1.2.1
Updating jiff v0.2.12 -> v0.2.14
Updating jiff-static v0.2.12 -> v0.2.14
Updating kqueue v1.0.8 -> v1.1.1
Updating litemap v0.7.5 -> v0.8.0
Adding once_cell_polyfill v1.70.1
Adding potential_utf v0.1.2
Updating rustversion v1.0.20 -> v1.0.21
Updating tempfile v3.19.1 -> v3.20.0
Updating tinystr v0.7.6 -> v0.8.1
Updating tokio v1.44.2 -> v1.45.0
Removing utf16_iter v1.0.5
Updating web_atoms v0.1.1 -> v0.1.2
Updating windows-core v0.61.0 -> v0.61.2
Updating windows-result v0.3.2 -> v0.3.4
Updating windows-strings v0.4.0 -> v0.4.2
Removing write16 v1.0.0
Updating writeable v0.5.5 -> v0.6.1
Updating yoke v0.7.5 -> v0.8.0
Updating yoke-derive v0.7.5 -> v0.8.0
Adding zerotrie v0.2.2
Updating zerovec v0.10.4 -> v0.11.2
Updating zerovec-derive v0.10.3 -> v0.11.1
2025-05-23 07:55:10 -07:00
Eric Huss
391ee3bae2 Merge pull request #2695 from hamirmahal/fix/invalid-heading-order-in-contributing-md
fix: invalid heading order in `CONTRIBUTING.md`
2025-05-23 14:53:01 +00:00
Hamir Mahal
ad3096e871 fix: invalid heading order in CONTRIBUTING.md 2025-05-23 07:46:40 -07:00
Eric Huss
179bd8dcd5 Merge pull request #2710 from ehuss/fix-mode-rust
Fix loading of mode-rust.js
2025-05-23 14:42:05 +00:00
Eric Huss
426e7bee17 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
2025-05-23 07:19:27 -07:00
Eric Huss
564c80bf6d Merge pull request #2709 from zeenix/master
Update `opener` to 0.8.1
2025-05-21 20:22:49 +00:00
Zeeshan Ali Khan
363c12e9c3 Update opener to 0.8.1
This removes a few indirect deps, especially system deps like `dbus` and
`pkg-config`.
2025-05-21 18:33:43 +02:00
Eric Huss
1ffa9fe830 Merge pull request #2707 from noritada/fix/edition2024-in-guide
Document the `edition2024` code block attribute
2025-05-19 15:38:52 +00:00
Noritada Kobayashi
91d13c390a Document the edition2024 code block attribute 2025-05-19 12:51:11 +09:00
Eric Huss
ce8d8120f8 Merge pull request #2705 from ehuss/help-test
Add help gui test
2025-05-15 12:32:27 +00:00
Eric Huss
038b5fb232 Add help gui test 2025-05-15 05:25:48 -07:00
Eric Huss
fd768efba2 Merge pull request #2703 from ehuss/fix-clippy
Fix clippy lint for 1.88
2025-05-15 01:27:40 +00:00
Eric Huss
481346812c Merge pull request #2608 from szabgab/navigation-help
Add pop-up window showing the keyboard shortcuts
2025-05-15 01:24:55 +00:00
Eric Huss
3d07798832 Fix clippy lint for 1.88 2025-05-14 18:18:45 -07:00
Eric Huss
33da0c26c4 Some updates to the help popup
This makes a few changes to the help popup:

- Move css to chrome.css, since this is a UI element.
- Move HTML code to index.hbs instead of generated in JavaScript.
  In general I prefer to keep HTML out of JavaScript when possible,
  and I didn't see a particular reason to avoid it.
- Added a click handler to dismiss the popup.
- Make sure handlers get removed when dismissed.
- Use `mdbook-` prefixes for IDs to avoid collisions with headers.
- Don't show search if it isn't enabled.
- Add the new `/` shortcut.
- Use flex layout for better positioning.
- Dim out the surrounding text using an overlay.
- Various other styling tweaks.
- Add a GUI test.
2025-05-14 18:17:16 -07:00
Eric Huss
91e94024cd Switch searcher to use keys instead of keyCodes
According to
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
the keyCode is deprecated (and removed). It is causing me some
difficulty with the GUI tests because it can't differentiate between a
slash and question mark correctly. Using keys seems to work.
2025-05-14 18:16:20 -07:00
Gabor Szabo
c9ad6dbf10 eslint 2025-05-14 17:06:49 -07:00
Gabor Szabo
2b455fcd34 Make the help visible in all the themes of mdbook
Also handle the ? key with or without shift being pressed.
2025-05-14 17:06:49 -07:00
Gabor Szabo
4573f4d882 Add pop-up window showing the keyboard shortcuts
Make it display when the user presses `?`.

Implements #2607
2025-05-14 17:06:49 -07:00
Eric Huss
63ae0d5c18 Merge pull request #2698 from traviscross/TC/search-ergonomics
Improve ergonomics of search
2025-05-14 00:43:24 +00:00
Travis Cross
52e406bf95 Use <kbd> tag to describe keyboard shortcuts
When describing, in the guide, the keyboard shortcuts that we accept,
let's use the `<kbd>` element.  This causes the key to render in a box
that people will recognize as conventional.

The way that this is displayed helps to make it clear that, though we
present the key in uppercase, we actually mean for the lowercase
letter to be entered.  Therefore, we present the key in uppercase
since 1) that's how it appears on most keyboards and 2) for some
characters such as `l`, presenting the character in lowercase might be
ambiguous.

We'll spell out "Escape" rather than saying "Esc" (even though many
keyboards spell it that way) since the `KeyboardEvent.keycode`[^1] is
called "Escape", and that's how it would appear in an
`aria-keyshortcuts` attribute[^2].

[^1]: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode

[^2]: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-keyshortcuts
2025-05-13 22:04:49 +00:00
Travis Cross
3e871d1971 Navigate to first search result on enter
It's common for search boxes like ours to automatically navigate to
the first search result when the `enter` / `select` key is pressed, as
that can allow for rapid navigation.  E.g., the MDN documentation does
this.

Let's similarly navigate to the first result when, in the search box,
the user presses the `enter` key and there is a first result to which
to navigate.
2025-05-13 21:50:04 +00:00
Travis Cross
84a5ba9707 Handle DOWN_KEYCODE with no results
If, when searching, one pressed the down arrow key when there were no
results, this caused an uncaught exception and defocused the search
box.

Let's prevent this and keep the search box focused when pressing down
in this state by checking first whether there is a result for us to
focus instead.
2025-05-13 21:50:04 +00:00
Travis Cross
44d9f4e95b Use / (or s) to open search box
We allow for using `s` to open the search box, but it's more common to
use `/` (forward slash) for this.  E.g., MDN's documentation uses `/`
for search.  Rustdoc and GitHub accept either.

Let's allow either key to be used, and let's switch to "advertising"
`/` rather than `s` in the hover text for the search button.

In making that switch, let's also simplify that hover text a bit.
Previously it had said "Search. (Shortkey: s)".  This was the only top
button on which we had included a period in the hover text.  Let's
remove that, and let's remove the "shortkey" bit of jargon.  It's
enough to just put `/` in a parenthetical, i.e. "Search (`/`)".
People will gleam from that what we mean.

We've also updated the guide accordingly.
2025-05-13 21:48:54 +00:00
Eric Huss
d24c0ca0d7 Merge pull request #2696 from paolobarbolini/once-cell-to-std
Replace `once_cell::sync::Lazy` with `std::sync::LazyLock`
2025-05-12 15:11:11 +00:00
Paolo Barbolini
623fc606a4 Replace once_cell::sync::Lazy with std::sync::LazyLock 2025-05-11 11:46:12 +02:00
Eric Huss
a8aee21cd0 Merge pull request #2691 from notriddle/knurling
sidebar: use the same resize grip as rustdoc and playground
2025-05-10 18:25:55 +00:00
Michael Howell
649a021647 sidebar: use the same resize grip as rustdoc and playground 2025-05-09 14:15:53 -07:00
Eric Huss
785ee564c5 Merge pull request #2690 from ehuss/bump-version
Update to 0.4.49
v0.4.49
2025-05-05 21:51:22 +00:00
Eric Huss
006f99ee99 Update to 0.4.49 2025-05-05 14:44:37 -07:00
Eric Huss
2a4e5140c9 Merge pull request #2689 from ehuss/revert-multilingual
Revert: Remove the book.multilingual field and don't serialize it
2025-05-05 21:13:46 +00:00
Eric Huss
3c10b00096 Skip serializing of the multilingual field
This skips serializing of the multilingual field since it is unused, and
we plan to remove it in the future. This helps avoid it showing up in
`mdbook init`.
2025-05-05 14:05:00 -07:00
Eric Huss
c9ddb4dd98 Revert: Remove the book.multilingual field
This reverts https://github.com/rust-lang/mdBook/pull/2646/ because I
overlooked that this is a public field in a public struct, which would
be a breaking API change.
2025-05-05 14:01:49 -07:00
Eric Huss
9822c2a178 Merge pull request #2688 from ehuss/update-dependencies
Update dependencies
2025-05-05 20:52:43 +00:00
Eric Huss
199efd0f2c Update dependencies
Updating ammonia v4.0.0 -> v4.1.0
Updating anyhow v1.0.95 -> v1.0.98
Updating bitflags v2.8.0 -> v2.9.0
Updating bstr v1.11.3 -> v1.12.0
Updating bumpalo v3.16.0 -> v3.17.0
Updating bytes v1.9.0 -> v1.10.1
Updating cc v1.2.10 -> v1.2.21
Updating chrono v0.4.39 -> v0.4.41
Updating clap v4.5.27 -> v4.5.37
Updating clap_builder v4.5.27 -> v4.5.37
Updating clap_complete v4.5.43 -> v4.5.48
  Adding cssparser v0.35.0
  Adding cssparser-macros v0.6.1
Updating darling v0.20.10 -> v0.20.11
Updating darling_core v0.20.10 -> v0.20.11
Updating darling_macro v0.20.10 -> v0.20.11
Updating data-encoding v2.7.0 -> v2.9.0
  Adding dtoa v1.0.10
  Adding dtoa-short v0.3.5
Updating env_logger v0.11.6 -> v0.11.8
Updating equivalent v1.0.1 -> v1.0.2
Updating errno v0.3.10 -> v0.3.11
Removing getrandom v0.2.15
  Adding getrandom v0.2.16
  Adding getrandom v0.3.2
Updating globset v0.4.15 -> v0.4.16
Updating handlebars v6.3.0 -> v6.3.2
Updating hashbrown v0.15.2 -> v0.15.3
Updating html5ever v0.27.0 -> v0.31.0
Updating http v1.2.0 -> v1.3.1
Updating httparse v1.10.0 -> v1.10.1
Removing humantime v2.1.0
Updating iana-time-zone v0.1.61 -> v0.1.63
Updating icu_locid_transform_data v1.5.0 -> v1.5.1
Updating icu_normalizer_data v1.5.0 -> v1.5.1
Updating icu_properties_data v1.5.0 -> v1.5.1
Updating indexmap v2.7.1 -> v2.9.0
Updating itoa v1.0.14 -> v1.0.15
  Adding jiff v0.2.12
  Adding jiff-static v0.2.12
Updating libc v0.2.169 -> v0.2.172
Updating linux-raw-sys v0.4.15 -> v0.9.4
Updating litemap v0.7.4 -> v0.7.5
Updating log v0.4.25 -> v0.4.27
Updating markup5ever v0.12.1 -> v0.16.1
  Adding match_token v0.1.0
Updating miniz_oxide v0.8.3 -> v0.8.8
Updating once_cell v1.20.2 -> v1.21.3
Updating pest v2.7.15 -> v2.8.0
Updating pest_derive v2.7.15 -> v2.8.0
Updating pest_generator v2.7.15 -> v2.8.0
Updating pest_meta v2.7.15 -> v2.8.0
  Adding phf_macros v0.11.3
Updating pin-project v1.1.8 -> v1.1.10
Updating pin-project-internal v1.1.8 -> v1.1.10
Updating pkg-config v0.3.31 -> v0.3.32
  Adding portable-atomic v1.11.0
  Adding portable-atomic-util v0.2.4
Updating ppv-lite86 v0.2.20 -> v0.2.21
Updating proc-macro2 v1.0.93 -> v1.0.95
Updating quote v1.0.38 -> v1.0.40
  Adding r-efi v5.2.0
Updating redox_syscall v0.5.8 -> v0.5.12
Updating rustix v0.38.44 -> v1.0.7
Updating rustversion v1.0.19 -> v1.0.20
Updating ryu v1.0.19 -> v1.0.20
Updating select v0.6.0 -> v0.6.1
Updating semver v1.0.25 -> v1.0.26
Updating serde v1.0.217 -> v1.0.219
Updating serde_derive v1.0.217 -> v1.0.219
Updating serde_json v1.0.137 -> v1.0.140
Updating sha2 v0.10.8 -> v0.10.9
Updating smallvec v1.13.2 -> v1.15.0
Updating socket2 v0.5.8 -> v0.5.9
Updating string_cache v0.8.7 -> v0.8.9
Updating string_cache_codegen v0.5.2 -> v0.5.4
Updating syn v2.0.96 -> v2.0.101
Updating synstructure v0.13.1 -> v0.13.2
Updating tempfile v3.15.0 -> v3.19.1
Updating terminal_size v0.4.1 -> v0.4.2
Updating thiserror v2.0.11 -> v2.0.12
Updating thiserror-impl v2.0.11 -> v2.0.12
Updating tokio v1.43.1 -> v1.44.2
Updating tokio-util v0.7.13 -> v0.7.15
Updating typenum v1.17.0 -> v1.18.0
Updating unicode-ident v1.0.16 -> v1.0.18
  Adding wasi v0.14.2+wasi-0.2.4
  Adding web_atoms v0.1.1
Updating windows-core v0.52.0 -> v0.61.0
  Adding windows-implement v0.60.0
  Adding windows-interface v0.59.1
  Adding windows-link v0.1.1
  Adding windows-result v0.3.2
  Adding windows-strings v0.4.0
  Adding wit-bindgen-rt v0.39.0
Updating zerocopy v0.7.35 -> v0.8.25
Updating zerocopy-derive v0.7.35 -> v0.8.25
Updating zerofrom v0.1.5 -> v0.1.6
Updating zerofrom-derive v0.1.5 -> v0.1.6
2025-05-05 13:44:40 -07:00
Eric Huss
17b197620b Merge pull request #2679 from lolbinarycat/sidebar-size-2678
fix(css): sidebar can no longer be larger than 80% of viewport width
2025-05-03 16:33:32 +00:00
Eric Huss
23abd20589 Merge pull request #2681 from krishanjmistry/issue-2649-footnotes
Warn on and ignore duplicate footnote definitions
2025-04-30 13:48:09 +00:00
Krishan Mistry
7e9be8dee3 Warn on duplicate footnote definition and ignore subsequent definitions 2025-04-30 06:39:48 -07:00
Krishan Mistry
09d22e926f Add a test for duplicate footnote definitions 2025-04-30 06:37:24 -07:00
Eric Huss
1696f5680e Move footnote expected HTML to a separate file
This output is starting to get a little long, so this moves it to a
separate file to keep things a little more tidy.
2025-04-30 06:36:09 -07:00
binarycat
a54ee0215e fix(css): sidebar can no longer be larger than 80% of viewport width 2025-04-25 14:29:58 -05:00
Eric Huss
9b12c5130f Merge pull request #2676 from ehuss/booktest
Introduce new testsuite infrastructure
2025-04-23 04:18:53 +00:00
Eric Huss
084771bcd5 Remove parse_existing_summary_files tests
Although there isn't a direct equivalent in the new testsuite, I felt
like these weren't adding any specific coverage that the existing tests
don't already exercise. If it does turn up that there is specific
coverage missing, then I would prefer to have tests which exercise the
specific thing of interest rather than have these kinds of non-specific
tests.
2025-04-22 21:11:54 -07:00