about summary refs log tree commit diff
path: root/src/librustdoc/html/mod.rs
AgeCommit message (Collapse)AuthorLines
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-8/+8
2021-12-13rustdoc: Add `UrlPartsBuilder`Noah Lev-0/+1
This is a type for efficiently and easily constructing the part of a URL after the domain: `nightly/core/str/struct.Bytes.html`. It allows simplifying some code and avoiding some allocations in the `href_*` functions. It will also allow making `Cache.paths` et al. use `Symbol` without having to allocate `String`s in the `href_*` functions. `String`s would be necessary otherwise because `Symbol::as_str()` returns `SymbolStr`, whose `Deref<Target = str>` impl requires the `str` to not outlive it. This is the primary motivation for the addition of `UrlPartsBuilder`.
2021-08-19Refactor Markdown length-limited summary implementationNoah Lev-0/+1
This commit refactors the implementation of `markdown_summary_with_limit()`, separating the logic of determining when the limit has been reached from the actual rendering process. The main advantage of the new approach is that it guarantees that all HTML tags are closed, whereas the previous implementation could generate tags that were never closed. It also ensures that no empty tags are generated (e.g., `<em></em>`). The new implementation consists of a general-purpose struct `HtmlWithLimit` that manages the length-limiting logic and a function `markdown_summary_with_limit()` that renders Markdown to HTML using the struct.
2021-04-17rustdoc: use more precise relative URLSMichael Howell-0/+3
Instead of using a depth counter and adding "../" to get to the top, this commit makes rustdoc actually compare the path of what it's linking from to the path that it's linking to. This makes the resulting HTML shorter. Here's a comparison of one of the largest (non-source) files in the Rust standard library docs (about 4% improvement before gzipping). $ wc -c struct.Wrapping.old.html struct.Wrapping.new.html 2387389 struct.Wrapping.old.html 2298538 struct.Wrapping.new.html Most if it can be efficiently gzipped away. $ wc -c struct.Wrapping.old.html.gz struct.Wrapping.new.html.gz 70679 struct.Wrapping.old.html.gz 70050 struct.Wrapping.new.html.gz But it also makes a difference in the final DOM size, reducing it from 91MiB to 82MiB.
2021-01-31rustdoc: Note why `rustdoc::html::markdown` is publicCamelid-0/+1
Almost all of the modules are crate-private, except for `rustdoc::json::types`, which I believe is intended to be for public use; and `rustdoc::html::markdown`, which is used externally by the error-index generator and so has to be public.
2020-11-15Make `markdown` module public for doc-testsJoshua Nelson-1/+1
2020-11-15Make all rustdoc functions and structs crate-privateJoshua Nelson-2/+2
This gives warnings about dead code.
2020-07-27Extract `Cache` and other types from `html` moduleJoseph Ryan-0/+9