3099 Commits

Author SHA1 Message Date
MichiRecRoom
07fb33f5da Hide the sidebar resize handle when scripting isn't available 2025-11-05 19:11:09 -08:00
Eric Huss
7d1566860c Merge pull request #2924 from ehuss/html-end-tags
Add better handling for unbalanced HTML tags
2025-11-06 03:02:40 +00:00
Eric Huss
f0117ec3df Add a comment about synchronizing the event stack 2025-11-05 11:45:46 -08:00
Eric Huss
22065ebc79 Give a warning for unclosed HTML tags
This changes the internal error message to a warning to let the user
know that the HTML tags are unbalanced. In the future this will be a
denyable lint.

This is a very primitive approach of just ignoring the end tag. Ideally
it should recover using the standard HTML parsing algorithm, since there
is a chance that there will be a cascade of errors under certain
unbalanced situations.
2025-11-05 11:42:43 -08:00
Eric Huss
5905bf1d85 Factor out Token::TagToken to combat rightwards drift 2025-11-05 11:33:58 -08:00
Eric Huss
1646e4923a Add a test for HTML tags out of sync 2025-11-05 11:19:42 -08:00
Eric Huss
1e190137c3 Add a check for unclosed elements on the stack
This checks for any unclosed elements when processing is finished. This
is intended to detect invalid HTML in the source, or bugs in the tree
builder. Raw HTML elements generate a warning (which in the future will
be a configurable lint). All other sync errors are internal errors as
they are not expected, and it would be helpful to know if they ever
happen.
2025-11-05 11:14:39 -08:00
Eric Huss
4417f8cb0a Add a test for unclosed HTML tags 2025-11-05 10:45:46 -08:00
Eric Huss
cc7f8be496 Merge pull request #2922 from ehuss/header-id-lowercase
Lowercase heading IDs
2025-11-05 00:14:42 +00:00
Eric Huss
051fc9f01d Add a comment about the intent of HTML id generation 2025-11-04 16:05:36 -08:00
Eric Huss
d0bde467e0 Lowercase heading IDs
This switches from ASCII lowercase to Unicode lowercase when generating
heading IDs. This brings mdbook more in line with other tools and sites
when they generate heading IDs. The generation still isn't 100% the same
as other tools and sites, but it is usually the same in most cases.

Closes https://github.com/rust-lang/mdBook/issues/1059
2025-11-04 16:05:31 -08:00
Eric Huss
475951c9ee Merge pull request #2921 from ehuss/header-id-changelog
Add note to changelog about a change in heading ID generation
2025-11-04 23:06:17 +00:00
Eric Huss
5b2cc1735b Add note to changelog about a change in heading ID generation
I didn't fully appreciate that this changed in
https://github.com/rust-lang/mdBook/pull/2844 which changed how text
content was collected from heading tags.
2025-11-04 14:56:08 -08:00
Eric Huss
1c00395230 Merge pull request #2920 from rust-lang/renovate/cargo-semver-checks-0.x
Update cargo-semver-checks to v0.45.0
2025-11-02 04:10:45 +00:00
renovate[bot]
9799326590 Update cargo-semver-checks to v0.45.0 2025-11-01 20:40:49 +00:00
Eric Huss
2546c8cc60 Merge pull request #2916 from rust-lang/update-dependencies
Update cargo dependencies
2025-11-01 04:14:37 +00:00
Eric Huss
33c9b4063e Merge pull request #2919 from rust-lang/renovate/node-24.x
Update dependency node to v24
2025-11-01 04:14:10 +00:00
Eric Huss
f66fd92f32 Merge pull request #2918 from rust-lang/renovate/actions-setup-node-6.x
Update actions/setup-node action to v6
2025-11-01 04:13:51 +00:00
Eric Huss
541e16335b Merge pull request #2917 from rust-lang/renovate/browser-ui-test-0.x
Update dependency browser-ui-test to v0.22.3
2025-11-01 04:13:28 +00:00
renovate[bot]
6cc40cb5f7 Update dependency node to v24 2025-11-01 00:33:10 +00:00
renovate[bot]
37f8a79d4d Update actions/setup-node action to v6 2025-11-01 00:33:06 +00:00
renovate[bot]
385246a9ef Update dependency browser-ui-test to v0.22.3 2025-11-01 00:33:02 +00: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
f27c3aea4c Merge pull request #2915 from ehuss/fontawesome-warning
Add a warning when a Font Awesome font is missing
2025-10-31 02:38:29 +00:00
Eric Huss
b3bd103742 Add a warning when a Font Awesome font is missing
With the migration to Font Awesome 6, I'm running into books where the
icon names are missing or have changed. This adds a warning to help
identify those situations.
2025-10-30 19:30:01 -07:00
Eric Huss
7e5fa3565b Add a fontawesome test for a missing icon
This is a test for when an icon is missing.
2025-10-30 19:27:40 -07:00
Eric Huss
6d9f49cbc5 Update fontawesome test to make it clear the intent
This example was intended to demonstrate that it only translates if
there are no child elements.
2025-10-30 19:24:49 -07:00
Eric Huss
8670bcc540 Merge pull request #2914 from ehuss/fix-print-relative
Fix print page links for internal links to non-chapters
2025-10-31 01:44:04 +00:00
Eric Huss
005f4d648a Fix print page links for internal links to non-chapters
This fixes links on the print page that go to an internal destination
that is not a chapter. The path would have the wrong relative
destination, and would be broken. The logic for detecting this was
incorrectly only checking if a link went outside the book, or didn't
have an html extension. This doesn't work for links to HTML files that
are inside the book, but not one of the chapters.
2025-10-30 18:37:12 -07:00
Eric Huss
59343b525d Add test for print relative for page that doesn't exist
An example where this can happen is a link to a page that was renamed
and redirected, or just a normal HTML file.
2025-10-30 18:04:51 -07:00
Eric Huss
e8d7dd6f57 Merge pull request #2913 from ehuss/html-definition-lists
Don't modify headers or dt if the tag is manually written HTML
2025-10-30 19:10:36 +00:00
Eric Huss
54175698d5 Don't modify headers or dt if the tag is manually written HTML
This changes it so that header and `<dt>` tags manually written as HTML
are not modified (no anchor, no id, etc.). This is to avoid mangling any
HTML that the user explicitly crafted.

I'm not sure what the fallout from the headers might be, since I'm not
100% sure there aren't uses where the user wanted mdbook to modify
manual HTML. However, I don't see any in rust-lang's use.
2025-10-30 11:47:43 -07:00
Eric Huss
07ed00e8f7 Add a test for manually written header tags 2025-10-30 11:40:46 -07:00
Eric Huss
ab8a4dfa5a Add a test for definition lists with manual HTML tags 2025-10-30 10:02:27 -07:00
Eric Huss
e2c954f693 Merge pull request #2911 from ehuss/trace-events
Add some trace logging for event processing
2025-10-30 03:42:12 +00:00
Eric Huss
b2111a3f91 Merge pull request #2910 from ehuss/contains-key
Add Config::contains_key
2025-10-30 03:35:48 +00:00
Eric Huss
8ba833feb2 Add some trace logging for event processing
This adds some trace logging to help debug markdown parsing and HTML
parsing.
2025-10-29 20:34:11 -07:00
Eric Huss
7124f4c7de Merge pull request #2909 from rust-lang/ehuss-patch-2
Fix typo in changelog
2025-10-30 03:30:04 +00:00
Eric Huss
1cc4cbb202 Add Config::contains_key
This adds the method `contains_key` to assist with detecting if a key is
set in the config. There have been a few scenarios where I have needed
this when upgrading to 0.5. For now this only supports the `output` and
`preprocessor`. Checking the presence in the other tables isn't easy,
but could potentially be added if needed.
2025-10-29 20:29:46 -07:00
Eric Huss
405f407260 Fix typo in changelog 2025-10-29 20:23:31 -07:00
Eric Huss
eaa778bebd Merge pull request #2908 from rust-lang/ehuss-patch-1
mdbook-compare: fix duplicate "diff" print
2025-10-30 02:51:01 +00:00
Eric Huss
a17c1d1b95 mdbook-compare: fix duplicate "diff" print
The "diff" arg is already in the args list.
2025-10-29 19:45:22 -07:00
Eric Huss
8a27d1b7ac Merge pull request #2904 from traviscross/TC/fix-ayu-comments
Remove italics from `ayu` quotes/comments for alignment
2025-10-28 19:50:07 +00:00
Eric Huss
d6cd50b601 Merge pull request #2907 from ehuss/search-feature
Expose "search" feature from mdbook-driver
2025-10-28 18:37:03 +00:00
Eric Huss
68d9bcfec4 Expose "search" feature from mdbook-driver
This allows users of mdbook-driver to easily enable the search feature.
2025-10-28 11:29:48 -07:00
Eric Huss
3fa49214ad Merge pull request #2905 from ehuss/fix-indented-code-block
Fix rust fenced code blocks with an indent
2025-10-28 01:44:41 +00:00
Eric Huss
ddf02e0c0c Fix rust fenced code blocks with an indent
This fixes a bug in the Rust code block partitioning that was
incorrectly removing the whitespace from the beginning of a code block.
2025-10-27 18:38:27 -07:00
Eric Huss
3992bc18f5 Add a test for a fenced code block with an indent 2025-10-27 18:35:39 -07:00
Travis Cross
49f9c9741e Remove italics from ayu quotes/comments for alignment
Comments in code examples often rely on exact column alignment,
e.g. for ASCII-art.  This alignment often relies on both code and
comment characters having exactly the same width.

Setting `font-style: italic` seems to break these invariants with
common monospace fonts used by browsers.  This may be due to font
synthesis when the monospace font does not have a native italic
variant.

E.g., see these code examples when using the `ayu` theme:

- https://doc.rust-lang.org/1.90.0/reference/types/closure.html#r-type.closure.drop-order
- https://doc.rust-lang.org/1.90.0/reference/types/impl-trait.html#r-type.impl-trait.generic-capture.precise.use

It seems more important to have correct alignment than to style these
elements in italics, so let's drop the italic styling.

One alternative would be to set `font-synthesis: none` instead.  This
would prevent font synthesis-related misalignment while still
rendering italics when a font supports italics natively.  This might
correct the alignment issue, but ASCII-art in comments often wants
vertical bars to actually be vertical, so it still seems better to
just turn off italics entirely.

A more minimal change might be to only drop this from comments and not
from `hljs-quote`, but it seems the styling for these classes are
usually kept in sync, so we preserve that here.
2025-10-27 20:26:04 +00:00
Eric Huss
f84b1a15b6 Merge pull request #2903 from ehuss/bump-version
Update to 0.5.0-beta.1
v0.5.0-beta.1
2025-10-26 20:02:56 +00:00