Skip to content

rustdoc: add unstable latex math markdown feature#156032

Draft
notriddle wants to merge 4 commits into
rust-lang:mainfrom
notriddle:rustdoc-texmath
Draft

rustdoc: add unstable latex math markdown feature#156032
notriddle wants to merge 4 commits into
rust-lang:mainfrom
notriddle:rustdoc-texmath

Conversation

@notriddle

Copy link
Copy Markdown
Contributor

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels May 1, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

This adds a flag to the doc context to track whether a rendering has a
math span anywhere in the page. If so, it loads the resources needed for
math, but otherwise it skips them. The math font, in particular, is
about 200K, which is bigger than Fira Sans.
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] unit_prefix test:false 0.058
error[E0532]: expected unit struct, unit variant or constant, found tuple variant `TagEnd::BlockQuote`
    --> src/tools/clippy/clippy_lints/src/doc/mod.rs:1150:29
     |
1150 |                         End(TagEnd::BlockQuote) => next_range.end,
     |                             ^^^^^^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `TagEnd::BlockQuote(_)`
     |
    ::: /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pulldown-cmark-0.13.3/src/lib.rs:388:5
     |
 388 |     BlockQuote(Option<BlockQuoteKind>),
     |     ---------- `TagEnd::BlockQuote` defined here

[RUSTC-TIMING] bstr test:false 0.398
   Compiling pulldown-cmark v0.11.3
error[E0532]: expected unit struct, unit variant or constant, found tuple variant `TagEnd::BlockQuote`
    --> src/tools/clippy/clippy_lints/src/doc/mod.rs:1174:17
     |
1174 |             End(TagEnd::BlockQuote) => {
     |                 ^^^^^^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `TagEnd::BlockQuote(_)`
     |
    ::: /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/pulldown-cmark-0.13.3/src/lib.rs:388:5
     |
 388 |     BlockQuote(Option<BlockQuoteKind>),
     |     ---------- `TagEnd::BlockQuote` defined here

[RUSTC-TIMING] rustc_tools_util test:false 0.066
    Checking spanned v0.4.1
[RUSTC-TIMING] build_script_build test:false 0.094
    Checking indicatif v0.18.4
---
[RUSTC-TIMING] ui_test test:false 0.999
error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> src/tools/clippy/clippy_lints/src/doc/doc_paragraphs_missing_punctuation.rs:59:37
    |
 59 |         Parser::new_ext(doc_string, main_body_opts() - Options::ENABLE_SMART_PUNCTUATION).into_offset_iter()
    |                                     ^^^^^^^^^^^^^^-- argument #1 of type `std::option::Option<&DocAttributeSyntax>` is missing
    |
note: function defined here
   --> compiler/rustc_resolve/src/rustdoc.rs:252:8
    |
252 | pub fn main_body_opts(doc_syntax: Option<&DocAttributeSyntax>) -> Options {
    |        ^^^^^^^^^^^^^^
help: provide the argument
    |
 59 |         Parser::new_ext(doc_string, main_body_opts(/* std::option::Option<&DocAttributeSyntax> */) - Options::ENABLE_SMART_PUNCTUATION).into_offset_iter()
    |                                                    ++++++++++++++++++++++++++++++++++++++++++++++

error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> src/tools/clippy/clippy_lints/src/doc/mod.rs:915:17
    |
915 |                 main_body_opts() - Options::ENABLE_SMART_PUNCTUATION,
    |                 ^^^^^^^^^^^^^^-- argument #1 of type `std::option::Option<&DocAttributeSyntax>` is missing
    |
note: function defined here
   --> compiler/rustc_resolve/src/rustdoc.rs:252:8
    |
252 | pub fn main_body_opts(doc_syntax: Option<&DocAttributeSyntax>) -> Options {
    |        ^^^^^^^^^^^^^^
help: provide the argument
    |
915 |                 main_body_opts(/* std::option::Option<&DocAttributeSyntax> */) - Options::ENABLE_SMART_PUNCTUATION,
    |                                ++++++++++++++++++++++++++++++++++++++++++++++

error[E0061]: this function takes 1 argument but 0 arguments were supplied
   --> src/tools/clippy/clippy_lints/src/doc/mod.rs:947:16
    |
947 |     let opts = main_body_opts() - Options::ENABLE_SMART_PUNCTUATION;
    |                ^^^^^^^^^^^^^^-- argument #1 of type `std::option::Option<&DocAttributeSyntax>` is missing
    |
note: function defined here
   --> compiler/rustc_resolve/src/rustdoc.rs:252:8
    |
252 | pub fn main_body_opts(doc_syntax: Option<&DocAttributeSyntax>) -> Options {
    |        ^^^^^^^^^^^^^^
help: provide the argument
    |
947 |     let opts = main_body_opts(/* std::option::Option<&DocAttributeSyntax> */) - Options::ENABLE_SMART_PUNCTUATION;
    |                               ++++++++++++++++++++++++++++++++++++++++++++++

[RUSTC-TIMING] askama test:false 0.286
Some errors have detailed explanations: E0061, E0532.
For more information about an error, try `rustc --explain E0061`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants