Commit Graph

382 Commits

Author SHA1 Message Date
Eric Huss
94569a42da Update to 0.5.2 2025-12-11 11:40:27 -08:00
renovate[bot]
3d39bf4adb Update Rust crate html5ever to 0.36.0 2025-12-01 18:31:50 +00:00
github-actions[bot]
8bd3c52abf Update cargo dependencies
```
name               old req compatible latest new req
====               ======= ========== ====== =======
axum               0.8.6   0.8.7      0.8.7  0.8.7
clap               4.5.51  4.5.53     4.5.53 4.5.53
clap_complete      4.5.60  4.5.61     4.5.61 4.5.61
indexmap           2.12.0  2.12.1     2.12.1 2.12.1
tower-http         0.6.6   0.6.7      0.6.7  0.6.7
tracing            0.1.41  0.1.43     0.1.43 0.1.43
tracing-subscriber 0.3.20  0.3.22     0.3.22 0.3.22
name                    old req compatible latest new req
====                    ======= ========== ====== =======
pulldown-cmark-to-cmark 21.0.0  21.1.0     21.1.0 21.1.0
```
2025-12-01 00:37:48 +00:00
Eric Huss
eb83d080f6 Update to 0.5.1 2025-11-19 17:36:49 -08:00
Eric Huss
262afdc2f8 Update to 0.5.0
This is the stable release of 0.5.0. No changes have been made since
0.5.0-beta.2.
2025-11-17 08:57:52 -08:00
Eric Huss
922f0d8ad4 Update to 0.5.0-beta.2.
I expect this to be the last pre-release before 0.5.
2025-11-07 18:00:52 -08:00
github-actions[bot]
7619f9a91c Update cargo dependencies
```
name          old req compatible latest new req
====          ======= ========== ====== =======
clap          4.5.50  4.5.51     4.5.51 4.5.51
clap_complete 4.5.59  4.5.60     4.5.60 4.5.60
ignore        0.4.24  0.4.25     0.4.25 0.4.25
snapbox       0.6.22  0.6.23     0.6.23 0.6.23
```
2025-11-01 00:32:23 +00:00
Eric Huss
ac11e00aa2 Update to 0.5.0-beta.1 2025-10-26 12:55:06 -07:00
github-actions[bot]
7945ac8e8c Update cargo dependencies
```
name          old req compatible latest  new req
====          ======= ========== ======  =======
anyhow        1.0.98  1.0.100    1.0.100 1.0.100
axum          0.8.4   0.8.6      0.8.6   0.8.6
clap          4.5.41  4.5.50     4.5.50  4.5.50
clap_complete 4.5.55  4.5.59     4.5.59  4.5.59
indexmap      2.10.0  2.12.0     2.12.0  2.12.0
ignore        0.4.23  0.4.24     0.4.24  0.4.24
memchr        2.7.5   2.7.6      2.7.6   2.7.6
notify        8.1.0   8.2.0      8.2.0   8.2.0
opener        0.8.2   0.8.3      0.8.3   0.8.3
regex         1.11.1  1.12.2     1.12.2  1.12.2
semver        1.0.26  1.0.27     1.0.27  1.0.27
serde         1.0.219 1.0.228    1.0.228 1.0.228
serde_json    1.0.140 1.0.145    1.0.145 1.0.145
snapbox       0.6.21  0.6.22     0.6.22  0.6.22
tempfile      3.20.0  3.23.0     3.23.0  3.23.0
tokio         1.46.1  1.48.0     1.48.0  1.48.0
toml          0.9.2   0.9.8      0.9.8   0.9.8
```
2025-10-21 01:16:53 +00:00
renovate[bot]
c438e13027 Update Rust crate notify-debouncer-mini to 0.7.0 2025-09-28 10:00:01 -07:00
Eric Huss
4fc72e8d9f Set up new workspace publish workflow
This sets up the publish workflow to use the new OIDC authentication,
and to publish the whole workspace at once.
2025-09-26 17:40:34 -07:00
Eric Huss
2b242494b0 Add a new HTML rendering pipeline
This rewrites the HTML rendering pipeline to use a tree data structure,
and implements a custom HTML serializer. The intent is to make it easier
to make changes and to manipulate the output. This should make some
future changes much easier.

This is a large change, but I'll try to briefly summarize what's
changing:

- All of the HTML rendering support has been moved out of
  mdbook-markdown into mdbook-html. For now, all of the API surface is
  private, though we may consider ways to safely expose it in the
  future.
- Instead of using pulldown-cmark's html serializer, this takes the
  pulldown-cmark events and translates them into a tree data structure
  (using the ego-tree crate to define the tree). See `tree.rs`.
- HTML in the markdown document is parsed using html5ever, and then
  lives inside the same tree data structure. See `tokenizer.rs`.
- Transformations are then applied to the tree data structure. For
  example, adding header links or hiding code lines.
- Serialization is a simple process of writing out the nodes to a
  string. See `serialize.rs`.
- The search indexer works on the tree structure instead of re-rendering
  every chapter twice. See `html_handlebars/search.rs`.
- The print page now takes a very different approach of taking the
  same tree structure built for rendering the chapters, and applies
  transformations to it. This avoid re-parsing everything again. See
  `print.rs`.
    - I changed the linking behavior so that links on the print page
      link to items on the print page instead of outside the print page.
- There are a variety of small changes to how it serializes as can be
  seen in the changes to the tests. Some highlights:
	- Code blocks no longer have a second layer of `<pre>` tags wrapping
      it.
    - Fixed a minor issue where a rust code block with a specific
      edition was having the wrong classes when there was a default
      edition.
- Drops the ammonia dependency, which significantly reduces the number
  of dependencies. It was only being used for a very minor task, and
  we can handle it much more easily now.
- Drops `pretty_assertions`, they are no longer used (mostly being
  migrated to the testsuite).

There's obviously a lot of risk trying to parse everything to such a low
level, but I think the benefits are worth it. Also, the API isn't super
ergonomic compared to say javascript (there are no selectors), but it
works well enough so far.

I have not run this through rigorous benchmarking, but it does have a
very noticeable performance improvement, especially in a debug build.

I expect in the future that we'll want to expose some kind of
integration with extensions so they have access to this tree structure
(or some kind of tree structure).

Closes https://github.com/rust-lang/mdBook/issues/1736
2025-09-16 20:26:35 -07:00
Eric Huss
d15a40123c Remove chrono
I accidentally missed this in https://github.com/rust-lang/mdBook/pull/2829.
2025-09-15 06:50:50 -07:00
Eric Huss
3e673ce424 Switch from log to tracing
This switches to using the tracing crate instead of log. Tracing
provides a lot of nice features which we can take advantage of moving
forward.

This also adjusts the output fairly significantly. This includes:

- Switched the environment variable from RUST_LOG to MDBOOK_LOG.
- Dropped the timestamp. I experimented with various different time
  displays, but ultimately decided to omit it for now. I don't think
  I've ever found it to be useful, and it takes up a very significant
  amount of space. It could potentially be useful for basic profiling,
  but I think there are other, better mechanisms for that. We could
  consider leveraging tracing itself for doing some basic profiling
  (like using something like tracing-chrome).
- Dropped the target unless MDBOOK_LOG is set. The target tends to be
  pretty noisy, and doesn't really convey much information unless you
  are debugging or otherwise trying to adjust the log output.
- Added color.
- Slightly reworked the way the error cause trace is displayed.
- Slightly changed the way html5ever filtering is done, as well as add
  handlebars to the list since they both are very noisy. You can
  override this now by explicitly listing them as targets.

I still expect that mdbook will eventually change how it displays things
to the console, possibly switching away from tracing and printing things
itself. However, that is a larger project for the future.
2025-09-12 06:13:45 -07:00
Eric Huss
29b71be0a5 Add the mdbook version to the first page of the guide
This displays the version of mdBook that the guide is for.
2025-09-03 15:06:33 -07:00
Eric Huss
d071d127ef Add globs to test path names
This adds the ability for some test functions to use a glob pattern to
match a single file. This will be helpful when testing hash-files
support.
2025-08-26 15:44:01 -07:00
Eric Huss
338a9b424e Change with_renderer/with_preprocessor to overwrite
This changes `with_renderer` and `with_preprocessor` to replace any
extensions of the same name instead of just appending to the list. This
is necessary for rust-lang's build process, because we replace the
preprocessors with local ones. Previously, mdbook would just print an
error, but continue working. With the change that preprocessors are no
longer optional by default, it is now required that we have a way to
replace the existing entries.
2025-08-18 11:18:31 -07:00
Michael Howell
2dc8c5e686 Use embedded SVG instead of fonts for icons
The [downsides of icon fonts] are well-documented, and also, why ship all of
the icons when it only uses 14?

[downsides of icon fonts]: https://speakerdeck.com/ninjanails/death-to-icon-fonts
2025-08-14 20:14:55 -07:00
Eric Huss
5956092b4b Switch all public types to non_exhaustive
This switches all public types to use non_exhaustive to make it easier
to make additions without a semver-breaking change.

Some of the ergonomics are hampered due to the lack of exhaustiveness
checking. Hopefully some day in the future,
non_exhaustive_omitted_patterns_lint or something like it will get
stabilized.

Closes https://github.com/rust-lang/mdBook/issues/1835
2025-08-09 17:02:01 -07:00
Roms1383
91f04bc7ba Upgrade pulldown-cmark to 0.13.0 2025-07-26 08:33:28 -07:00
Eric Huss
26319f4124 Update toml to 0.9.2 2025-07-25 13:24:27 -07:00
Eric Huss
f6c062fc98 Enable unreachable_pub
This lint can help make it clearer which items are actually exposed in
the public API.
2025-07-25 09:02:55 -07:00
Eric Huss
6e6518a7ae Move the remaining dependencies to the workspace table
This is intended to have all dependencies only defined in the workspace
table, and crates can then refer to it.
2025-07-23 17:47:31 -07:00
Eric Huss
12fc0ff5c3 Clean up dependencies of mdbook
These are no longer used, or are dev-dependencies only.
2025-07-23 17:47:31 -07:00
Eric Huss
40745600a3 Finish move of MDBook to mdbook-driver 2025-07-23 17:47:31 -07:00
Eric Huss
f5fc54461a Finish moving built-in preprocessors to mdbook-driver 2025-07-23 17:40:57 -07:00
Eric Huss
c8571f592c Add mdbook-driver
This is intended to hold the high-level MDBook type.
2025-07-23 17:40:57 -07:00
Eric Huss
7eccd1d556 Finish move of hbs_renderer to mdbook-html
This updates everything for the move of hbs_renderer to mdbook-html.
2025-07-23 17:40:57 -07:00
Eric Huss
753780f653 Finish move of theme to mdbook-html
This updates everything for the move of theme to mdbook-html. There
will be followup commits that will be doing more cleanup here.
2025-07-23 17:40:57 -07:00
Eric Huss
6805740e20 Add mdbook-html
This new crate will hold the HTML renderer and related front-end parts.
2025-07-23 17:29:55 -07:00
Eric Huss
8f3b6b4776 Move markdown support to mdbook-markdown
This moves all the code responsible for markdown processing to the
mdbook-markdown crate.
2025-07-23 17:29:55 -07:00
Eric Huss
3278f84373 Move renderer types to mdbook-renderer
This sets up mdbook-renderer with the intent of being the core
library that renderers use to implement the necessary interactions.
2025-07-23 17:29:55 -07:00
Eric Huss
12285f505d Move preprocessor types to mdbook-preprocessor
This sets up mdbook-preprocessor with the intent of being the core
library that preprocessors use to implement the necessary interactions.
2025-07-23 17:29:55 -07:00
Eric Huss
7bcdfe6f0f Finish move of summary to mdbook-summary
This updates everything for the move of summary to mdbook-summary. There
will be followup commits that will be doing more cleanup here.
2025-07-23 17:29:55 -07:00
Eric Huss
bd3e555962 Add mdbook-summary
This new crate will hold the Summary types and parsing support.
2025-07-23 17:29:55 -07:00
Eric Huss
02b6628048 Finish move of config to mdbook-core
This updates everything for the move of config to mdbook-core. There
will be followup commits that will be moving and refactoring the config.
This simply moves it over unchanged.
2025-07-23 17:29:55 -07:00
Eric Huss
fc76a47d6e Finish move of utils to mdbook-core
This updates everything for the move of utils to mdbook-core. There will
be followup commits that will be moving and refactoring these utils.
This simply moves them over unchanged (except visibility).
2025-07-23 17:29:55 -07:00
Eric Huss
f51d89ba02 Move error types to mdbook-core
This moves Result and Error to mdbook-core with the anticipation of
using them in user crates. For now, the internal APIs will be using
anyhow directly, but the intent is to transition more of these to
mdbook-core where it makes sense.
2025-07-23 17:29:55 -07:00
Eric Huss
bc3399cc22 Update version to 0.5.0-alpha.1
This bumps the main crate to 0.5.0-alpha.1 in preparation for the 0.5
release.
2025-07-23 17:29:55 -07:00
Eric Huss
4a655ff2a3 Add mdbook-core
This is intended as a shared, internal library that will be used by
other mdbook crates. The intention is that those crates will either
directly use, or reexport items from this crate.

Initially this includes MDBOOK_VERSION, which will get reexported from
the preprocessor and renderer crates.
2025-07-23 17:29:55 -07:00
Eric Huss
d5a505e0c6 Update to Rust 2024 2025-07-23 17:29:12 -07:00
Eric Huss
d6d5d6e674 Move common package settings to shared workspace table
This moves common settings that can be shared across crates to the
shared workspace table. This will make it easier to maintain these
settings when adding more crates.
2025-07-23 17:29:12 -07:00
Eric Huss
5264074c1b Move common lint controls to Cargo.toml
This moves lint overrides to Cargo.toml so that they can more easily be
shared across crates.
2025-07-23 17:29:12 -07:00
Eric Huss
92836f3988 Remove clippy needless-lifetimes workaround
This is no longer needed now that 1.87 has reached the stable channel.
2025-07-21 09:35:54 -07:00
Eric Huss
432b4296ab Update to 0.4.52 2025-07-14 15:45:55 -07:00
Jelmer Vernooij
8e579072b8 Replace warp with axum
warp is problematic for Debian, since it has some outdated dependencies. Upstream is also fairly dormant.
2025-07-14 15:00:34 -07:00
Eric Huss
76be253f76 Update to 0.4.51 2025-05-26 11:01:12 -07:00
Eric Huss
cdbf6d2806 Merge pull request #2712 from ehuss/bump-version
Update to 0.4.50
2025-05-23 15:04:07 +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