Guillaume Gomez
2c382a58d3
Greatly speed up search index load
2025-04-02 21:03:12 +02:00
Guillaume Gomez
418d677584
Improve warning message when search index is too big
2025-03-22 17:49:30 +01:00
Guillaume Gomez
a0eb8c0a0e
Remove JSON search file
2025-03-22 17:48:16 +01:00
Eric Huss
98abb22be1
Merge pull request #1368 from notriddle/hash-files
...
feat(html): cache bust static files by adding hashes to file names
2025-02-20 18:32:17 +00:00
Eric Huss
ab304e7d38
More code simplification
2025-02-20 10:25:14 -08:00
Eric Huss
fbc21592af
Some clippy cleanup
2025-02-20 10:23:47 -08:00
Eric Huss
e7b69114ed
Remove some code duplication
2025-02-20 10:19:04 -08:00
Michael Howell
8a9ecd212d
Fix, and test, the no-js toc sidebar with hashed resources
...
To make this work, I need to break the circular dependency and
stop hashing toc.html itself.
2025-02-20 10:27:18 -07:00
Eric Huss
2a4e5583ab
Rewrite test to use tempfile
...
We don't want to be writing to arbitrary directories, and this
seems to make the test a little simpler.
2025-02-20 08:48:16 -08:00
Eric Huss
3978612611
Update some comments and formatting
2025-02-20 08:47:03 -08:00
Eric Huss
5777a0edc4
Fix issue with None source_path
...
This fixes an issue where mdbook would panic if a non-draft chapter has
a None source_path when generating the search index. The code was
assuming that only draft chapters would have that behavior. However, API
users can inject synthetic chapters that have no path on disk.
This updates it to fall back to the path, or skip if neither is set.
2025-02-17 09:41:52 -08:00
Michael Howell
879449447f
feat(html): cache bust static files by adding hashes to file names
...
Closes rust-lang#1254
2025-02-13 10:39:22 -07:00
Eric Huss
09a37284b0
Add output.html.search.chapter
...
This config setting provides the ability to disable search indexing on a
per-chapter (or sub-path) basis.
This is structured to possibly add additional settings, such as perhaps
a score multiplier or other settings.
2025-01-27 19:45:50 -08:00
Max Heller
d325e821cd
fix: make line hiding in Rust code blocks consistent with rustdoc
...
Requires a space following a `#` for a line to be hidden.
2025-01-20 11:43:39 -05:00
Eric Huss
271bbba7dd
Merge pull request #2414 from notriddle/on2
...
Load the sidebar toc from a shared JS file or iframe
2024-11-02 23:56:19 +00:00
Hamir Mahal
f9add3e936
fix: formatting in src/ and tests/ directories
2024-09-21 15:56:13 -07:00
Hamir Mahal
1fd9656291
style: simplify string formatting for readability
2024-09-21 15:53:59 -07:00
Michael Howell
203685e91c
Make the sidebar work without JS
...
Uses an iframe instead. The downside of iframes comes from them
not necessarily being same-origin as the main page (particularly
with `file:///` URLs), which can cause themes to fall out of sync,
but that's not a problem here since themes don't work without JS
anyway.
2024-07-16 12:38:00 -07:00
Michael Howell
2cb5b85ab2
Load the sidebar toc from a shared JS file
...
Before this change, the Rust `unstable-book` is 88MiB.
With this change, it becomes 15MiB. Other pages might not be
as extreme, but it's expected to help any book like this.
This change is so drastic because, if every chapter has a link to
every other chapter, the result is *O*(n<sup>2</sup>) text output.
2024-07-15 18:51:32 -07:00
Eric Huss
1e4d4887e1
Add support for Rust Edition 2024
2024-06-12 15:53:56 -07:00
Eric Huss
65932289f7
Revert "Merge pull request #2381 from ehuss/update-pulldown-cmark"
...
This reverts commit 8884008b4d ,
(https://github.com/rust-lang/mdBook/pull/2381 ) reversing
changes made to 3d6caa504f .
The `pulldown_cmark` types are a public API, which I did not realize.
2024-05-16 18:08:09 -07:00
Eric Huss
af3012b0f2
Update pulldown-cmark to 0.11
2024-05-16 14:17:19 -07:00
expikr
c2eb375f69
Fix spacers in summary with folding.
...
The spacer was incorrectly being included in the previous fold.
2024-05-13 14:10:42 -07:00
Eric Huss
83444650a3
Merge pull request #2376 from ehuss/clippy-fixes
...
Apply a few minor clippy fixes
2024-05-13 19:18:52 +00:00
Eric Huss
5bc87d5c17
Apply a few minor clippy fixes
2024-05-13 12:13:50 -07:00
Eric Huss
7a58c415de
Remove cargo-clippy unknown feature
2024-05-13 12:07:49 -07:00
Eric Huss
d28cf53009
Rename curly-quotes to smart-punctuation.
2024-02-25 13:42:44 -08:00
Eric Huss
42e635bb9e
Update pulldown_cmark to 0.10
2024-02-05 14:11:27 -08:00
klensy
e3ad9d097e
reduce useless regex allocs
...
from 474mb to 215mb
==40876== Total: 474,156,323 bytes in 1,521,025 blocks
==40876== At t-gmax: 13,872,954 bytes in 4,655 blocks
==40876== At t-end: 488,516 bytes in 884 blocks
==40876== Reads: 820,933,434 bytes
==40876== Writes: 514,838,350 bytes
to
==57763== Total: 215,292,393 bytes in 1,161,048 blocks
==57763== At t-gmax: 13,872,954 bytes in 4,655 blocks
==57763== At t-end: 1,210,783 bytes in 1,274 blocks
==57763== Reads: 598,542,892 bytes
==57763== Writes: 229,841,910 bytes
2024-01-14 15:17:31 +03:00
klensy
573b6522f9
remove useless alloc
...
on rust reference book this reduces total allocs from 490mb to 474mb:
==23272== Total: 490,538,699 bytes in 1,760,117 blocks
==23272== At t-gmax: 13,872,954 bytes in 4,655 blocks
==23272== At t-end: 488,516 bytes in 884 blocks
==23272== Reads: 830,509,060 bytes
==23272== Writes: 522,290,614 bytes
to
==40876== Total: 474,156,323 bytes in 1,521,025 blocks
==40876== At t-gmax: 13,872,954 bytes in 4,655 blocks
==40876== At t-end: 488,516 bytes in 884 blocks
==40876== Reads: 820,933,434 bytes
==40876== Writes: 514,838,350 bytes
2024-01-14 15:17:07 +03:00
Ning Sun
a42eafc316
feat: upgrade handlebars to 5.0
2024-01-04 20:16:34 +08:00
klensy
88be4ac417
remove useless string clone
2023-12-16 13:29:24 +03:00
Jonathan Hult
91af1c3b54
Remove warning check for theme directory as ./src/theme
...
This was causing an unnecessary warning if &src_dir was the same as ctx.root
2023-12-09 16:53:57 -06:00
cN3rd
7717b9dcf2
Support text_direction attribute in HTML output
2023-09-02 07:50:21 -07:00
Eric Huss
c9cfe22fd6
Apply some code style changes.
2023-05-28 14:04:58 -07:00
Jannik Obermann
7df1d8c838
Support hidden lines in languages other than Rust
...
Co-Authored-By: thecodewarrior <5467669+thecodewarrior@users.noreply.github.com>
2023-05-28 14:04:54 -07:00
Eric Huss
1db52ff531
Fix search for custom heading attributes
2023-05-28 12:03:03 -07:00
Eric Huss
34e5ef22a0
Don't include empty class attribute.
2023-05-28 11:33:00 -07:00
ImUrX
c8a5adcee9
fix more mistakes
2023-05-28 10:47:14 -07:00
ImUrX
ecdb411711
fix mistakes
2023-05-28 10:47:14 -07:00
ImUrX
a4e206168d
Add working heading extension
2023-05-28 10:47:13 -07:00
Eric Huss
45a8575b95
Apply clippy::needless_borrow
2023-05-13 09:44:11 -07:00
Eric Huss
01047846a9
Don't copy the stock fonts if the user has overridden fonts.css.
...
This wasn't behaving as I was really intending.
2023-05-13 09:05:25 -07:00
Eric Huss
75a6d65e5a
Don't warn on copy-fonts=true (the default) when fonts.css is overridden.
2023-05-13 08:51:04 -07:00
Tetsuya Morimoto
04016f3be6
Refactor the warning message related to copy_fonts so that a user simply configures it
2023-04-28 12:46:49 +09:00
Eric Huss
c2d973997a
Make fonts part of the theme.
2023-01-15 11:42:46 -08:00
Eric Huss
f32bd6f945
Show the currently selected theme.
2022-11-21 15:27:39 -08:00
David
75857fbf73
feat: use once_cell instead of lazy_static ( #1894 )
2022-09-22 15:05:39 -07:00
Martin Geisler
3958260353
Simplify the use of Option::and_then
...
I found a few places where `Option::and_then` could be simplified (in
my opinion) with `?` or with `match`.
2022-09-11 00:46:26 +02:00
Dylan DPC
66bf85b14f
Require Rust 2021 edition
...
This allows us to clean up and simplify the code.
2022-09-09 16:00:35 +02:00