summary refs log tree commit diff
path: root/src/librustdoc/html/markdown.rs
AgeCommit message (Collapse)AuthorLines
2023-05-26rustdoc: get unnormalized link destination for suggestionsMichael Howell-9/+111
Fixes #110111 This bug, and the workaround in this commit, is closely linked to [raphlinus/pulldown-cmark#441], getting offsets of link components. In particular, pulldown-cmark doesn't provide the offsets of the contents of a link. To work around this, rustdoc parser parts of a link definition itself. [raphlinus/pulldown-cmark#441]: https://github.com/raphlinus/pulldown-cmark/issues/441
2023-05-21rustdoc: include strikethrough in item summaryLukas Markeffsky-1/+9
2023-05-16Avoid `&format("...")` calls in error message code.Nicholas Nethercote-2/+2
Error message all end up passing into a function as an `impl Into<{D,Subd}iagnosticMessage>`. If an error message is creatd as `&format("...")` that means we allocate a string (in the `format!` call), then take a reference, and then clone (allocating again) the reference to produce the `{D,Subd}iagnosticMessage`, which is silly. This commit removes the leading `&` from a lot of these cases. This means the original `String` is moved into the `{D,Subd}iagnosticMessage`, avoiding the double allocations. This requires changing some function argument types from `&str` to `String` (when all arguments are `String`) or `impl Into<{D,Subd}iagnosticMessage>` (when some arguments are `String` and some are `&str`).
2023-04-16Spelling librustdocJosh Soref-1/+1
* associated * collected * correspondence * inlining * into * javascript * multiline * variadic Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-12remove some unneeded importsKaDiWa-1/+0
2023-03-19Remove footnote references from doc summaryGuillaume Gomez-1/+13
2023-02-28Auto merge of #108098 - notriddle:notriddle/rustdoc-tooltip-alloc, ↵bors-4/+4
r=GuillaumeGomez rustdoc: reduce allocations when generating tooltips An attempt to reduce the perf regression in https://github.com/rust-lang/rust/pull/108052#issuecomment-1430631861
2023-02-23rustdoc: avoid including `<li>` tags in item table short descMichael Howell-4/+1
Fixes a bug seen at https://docs.rs/gl_constants/0.1.1/gl_constants/index.html
2023-02-22rustdoc: reduce allocations when generating tooltipsMichael Howell-4/+4
An attempt to reduce the perf regression in https://github.com/rust-lang/rust/pull/108052#issuecomment-1430631861
2023-02-18doc links: Filter away autolinks in both rustc and rustdocVadim Petrochenkov-16/+8
2023-02-18rustdoc: Cleanup broken link callbacksVadim Petrochenkov-29/+17
2023-02-18rustdoc: Do not use Footnotes and HeadingLinks when extracting doc linksVadim Petrochenkov-8/+3
they do not add any `Link` events
2023-02-13rustdoc: add more tooltips to intra-doc linksMichael Howell-5/+11
This commit makes intra-doc link tooltips consistent with generated links in function signatures and item tables, with the format `itemtype foo::bar::baz`. This way, you can tell if a link points at a trait or a type (for example) by mousing over it. See also fce944d4e79b3a87ddf511206724edf33acfd704
2023-02-12Rollup merge of #107934 - ↵Matthias Krüger-2/+11
notriddle:notriddle/intra-doc-link-meta-description, r=camelid,GuillaumeGomez rustdoc: account for intra-doc links in `<meta name="description">` Similar to #86451, but for the SEO descriptions instead of the search descriptions.
2023-02-11rustdoc: account for intra-doc links in `<meta name="description">`Michael Howell-2/+11
2023-02-11Rollup merge of #107909 - notriddle:notriddle/register-header-empty-cond, ↵Matthias Krüger-5/+1
r=camelid rustdoc: remove redundant `if s.is_empty()` from `find_testable_code`
2023-02-10rustdoc: remove redundant `if s.is_empty()` from `find_testable_code`Michael Howell-5/+1
2023-02-10Resolve documentation links in rustc and store the results in metadataVadim Petrochenkov-9/+1
This commit implements MCP https://github.com/rust-lang/compiler-team/issues/584 It also removes code that is no longer used, and that includes code cloning resolver, so issue #83761 is fixed.
2023-02-09Rollup merge of #107655 - notriddle:notriddle/small-url-encode, r=GuillaumeGomezDylan DPC-41/+2
rustdoc: use the same URL escape rules for fragments as for examples Carries over improvements from #107284
2023-02-06Turn MarkdownWithToc into a struct with named fieldsGuillaume Gomez-9/+9
2023-02-03rustdoc: use the same URL escape rules for fragments as for examplesMichael Howell-41/+2
2023-01-27Remove from librustdoc and clippy tooScott McMurray-3/+3
2023-01-27Rollup merge of #107325 - petrochenkov:hiddoc2, r=GuillaumeGomezYuki Okushi-32/+12
rustdoc: Stop using `HirId`s Use `LocalDefId`s instead. Rustdoc doesn't work with item bodies, so it almost never needs fine-grained HIR IDs.
2023-01-26rustdoc: use smarter encoding for playground URLMichael Howell-1/+18
The old way would compress okay with DEFLATE, but this version makes uncompressed docs smaller, which matters for memory usage and stuff like `cargo doc`. Try it out: <https://play.rust-lang.org/?code=fn+main()+{%0Alet+mut+v+=+Vec::new();%0Av.push(1+/+1);%0Aprintln!(%22{}%22,+v[0]);%0A}> In local testing, this change shrinks sample pages by anywhere between 4.0% and 0.031% $ du -b after.dir/std/vec/struct.Vec.html before.dir/std/vec/struct.Vec.html 759235 after.dir/std/vec/struct.Vec.html 781842 before.dir/std/vec/struct.Vec.html 100*((759235-781842)/781842)=-2.8 $ du -b after.dir/std/num/struct.Wrapping.html before.dir/std/num/struct.Wrapping.html 3194173 after.dir/std/num/struct.Wrapping.html 3204351 before.dir/std/num/struct.Wrapping.html 100*((3194173-3204351)/3204351)=-0.031 $ du -b after.dir/std/keyword.match.html before.dir/std/keyword.match.html 8151 after.dir/std/keyword.match.html 8495 before.dir/std/keyword.match.html 100*((8151-8495)/8495)=-4.0 Gzipped tarball sizes seem shrunk, but not by much. du -s before.tar.gz after.tar.gz 69600 before.tar.gz 69480 after.tar.gz 100*((69480-69600)/69600)=-0.17
2023-01-26rustdoc: Stop using `HirId`sVadim Petrochenkov-32/+12
Use `LocalDefId`s instead
2023-01-13Playground.crate_name String -> Symbolklensy-3/+3
2022-12-16Don't add "Read more" link if there is no extra contentGuillaume Gomez-6/+21
2022-12-13Improve rustdoc markdown variable namingGuillaume Gomez-5/+5
2022-12-10Don't take into account hashtag prepended lines if not in rust code blockGuillaume Gomez-3/+4
2022-10-15rustdoc: make the help button a link to a pageMichael Howell-0/+1
This allows you to open the help section in a new browser tab, which is a pretty reasonable thing to want for a documentation page.
2022-10-01rustdoc: adopt to the new lint APIMaybe Waffle-5/+2
2022-09-22rustdoc: clean up CSS/DOM for deprecation warningsMichael Howell-11/+8
2022-09-13rustdoc: clean up DOM by removing `.dockblock-short p`Michael Howell-1/+5
On https://doc.rust-lang.org/nightly/std/ this reduces the number out of `document.querySelectorAll("*").length` from 1278 to 1103.
2022-08-11Rollup merge of #100374 - ↵Matthias Krüger-1/+2
GuillaumeGomez:improve_rustdoc_search_results_page_crates_selection, r=notriddle Improve crate selection on rustdoc search results page Take over of #98855 (screenshots and explanations are there). You can test it [here](https://rustdoc.crud.net/imperio/improve_rustdoc_search_results_page_crates_selection/std/index.html?search=test). cc ``@steffahn`` ``@jsha`` r? ``@notriddle``
2022-08-11Rollup merge of #99337 - jsha:simplify-highlight, r=GuillaumeGomezMatthias Krüger-15/+8
rustdoc: simplify highlight.rs Split render_with_highlighting, which took many optional parameters, into three functions for specific purposes, which each take a smaller number of mostly required parameters. Remove some plumbing to pass through an "edition" parameter, which was used solely to avoid highlighting some 2021 Edition keywords in non-2021 code. I've tested a build of std docs before and after, and this does not change the generated HTML at all. Followup from https://github.com/rust-lang/rust/pull/91264#discussion_r901151101 r? ```@GuillaumeGomez```
2022-08-10Add missing ID into the ID mapGuillaume Gomez-1/+2
2022-08-09rustdoc: simplify highlight.rsJacob Hoffman-Andrews-15/+8
Split render_with_highlighting, which took many optional parameters, into three functions for specific purposes, which each take a smaller number of mostly required parameters. Remove some plumbing to pass through an "edition" parameter, which was used solely to avoid highlighting some 2021 Edition keywords in non-2021 code.
2022-07-25Add a clickable link to the layout sectionest31-0/+1
2022-07-14Removed unused HTML IDsGuillaume Gomez-2/+0
2022-05-24fix simple clippy lintsklensy-6/+6
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-43/+46
2022-05-14Remove theme picker buttonGuillaume Gomez-2/+0
2022-04-30Move settings into full JSGuillaume Gomez-1/+4
2022-04-21Auto merge of #96260 - Kobzol:rustdoc-idmap, r=petrochenkovbors-44/+48
rustdoc: Optimize IdMap Slightly optimizes `IdMap`, which is hot in `markdown_links` (context [here](https://github.com/rust-lang/rust/pull/96135#issuecomment-1103539052)). There are more improvements that can be made near this place, but this seemed like an easy win locally (although I tried it on top of https://github.com/rust-lang/rust/pull/94857, so let's see what happens without that PR). r? `@petrochenkov`
2022-04-21rustdoc: Optimize IdMapJakub Beránek-44/+48
2022-04-20Remove `<>` links to be potential intra-doc linksGuillaume Gomez-1/+13
2022-04-19rustdoc: Cache preprocessed markdown linksVadim Petrochenkov-4/+6
2022-04-12rustdoc: discr. required+provided assoc consts+tysLeón Orell Valerian Liehr-2/+4
2022-04-09rustdoc: Reduce allocations in a `html::markdown` functionRoc Yu-7/+5
2022-03-10Rollup merge of #93950 - T-O-R-U-S:use-modern-formatting-for-format!-macros, ↵Dylan DPC-1/+1
r=Mark-Simulacrum Use modern formatting for format! macros This updates the standard library's documentation to use the new format_args syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored). `eprintln!("{}", e)` becomes `eprintln!("{e}")`, but `eprintln!("{}", e.kind())` remains untouched.