about summary refs log tree commit diff
path: root/src/librustdoc/html/render/write_shared.rs
AgeCommit message (Collapse)AuthorLines
2021-10-25Fix clippy lints in librustdocGuillaume Gomez-1/+1
2021-10-23Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514Matthias Krüger-0/+9
Scrape code examples from examples/ directory for Rustdoc Adds support for the functionality described in https://github.com/rust-lang/rfcs/pull/3123 Matching changes to Cargo are here: https://github.com/rust-lang/cargo/pull/9525 Live demo here: https://willcrichton.net/example-analyzer/warp/trait.Filter.html#method.and
2021-10-12rustdoc: update noto sans krShinwoo Park-2/+3
2021-10-06Unversioned -> InvocationSpecificWill Crichton-1/+1
2021-10-06Fix lint error, change scrape-examples.js minify callWill Crichton-1/+6
2021-10-06Move JS into a standalone fileWill Crichton-0/+4
2021-09-17Add rustdoc version into the help popupGuillaume Gomez-4/+12
2021-09-16Auto merge of #88219 - jyn514:parallel-io, r=GuillaumeGomezbors-31/+39
rustdoc: reduce number of copies when using parallel IO This is Windows-only for now; I was getting really bad slowdowns from this on linux for some reason. Helps with https://github.com/rust-lang/rust/issues/82741. Follow-up to https://github.com/rust-lang/rust/pull/60971.
2021-08-26Remove unnecessary copies when using parallel IOJoshua Nelson-31/+39
Previously, rustdoc was making lots of copies of temporary owned values. Now, it uses the owned value wherever possible.
2021-08-22Move Cache from Context to SharedContextJoshua Nelson-5/+6
2021-08-05Add links on source types to go to definitionGuillaume Gomez-2/+2
2021-08-03Simplify usage of CSS background-imageGuillaume Gomez-6/+41
2021-08-03Rustdoc accessibility: use an icon for the [-]/[+] controlsMichael Howell-2/+5
This way, we can show the plus and minus buttons on screens, while voice control will read off actual words "Collapse" and "Expand" instead of reading "open brace minus close brace" and "open brace plus close brace". Part of #87059
2021-06-22Rollup merge of #86402 - tspiteri:source-woff2, r=jshaYuki Okushi-0/+6
rustdoc: add optional woff2 versions of Source Serif and Source Code This provides woff2 versions of Source Serif and Source Code similar to how #82545 provides woff2 versions of Fira Sans. The total byte count for the six files (three for each font family) is reduced by 25% from 476 KiB to 358 KiB.
2021-06-20Use Tera templates for rustdoc.Jacob Hoffman-Andrews-1/+8
Replaces a format!() call in layout::render with a template expansion. Introduces a `templates` field in SharedContext so parts of rustdoc can share pre-rendered templates. This currently builds in a copy of the single template available, like with static files. However, future work can make this live-loadable with a perma-unstable flag, to make rustdoc developers' work easier.
2021-06-17rustdoc: add optional woff2 versions of Source Serif and Source CodeTrevor Spiteri-0/+6
2021-05-31Remove unneeded file to load sidebar items at crate levelGuillaume Gomez-1/+0
2021-05-28Remove `--print unversioned-files` from rustdocBoris-Chengbiao Zhou-1/+1
This flag isn't needed anymore. See #83784.
2021-05-26Rollup merge of #84048 - konan8205:master, r=jshaYuki Okushi-0/+2
Avoid CJK legacy fonts in Windows As metioned in #84035, the default serif CJK font in Windows is meh-looking. To avoid this, we should use sans-serif font or provide CJK glyph supported font in `rustdoc.css`.
2021-05-16Auto merge of #85304 - Stupremee:crates-in-sidebar-in-root, r=Nemo157bors-0/+2
rustdoc: Call `initSidebarItems` in root module of crate r? `@jsha` Resolves #85301
2021-05-15Call `initSidebarItems` in root module of crateJustus K-0/+2
2021-05-15Minimize amount of fake `DefId`s used in rustdocJustus K-2/+0
2021-05-15rustdoc: update static filesShinwoo Park-0/+2
2021-05-10Use an SVG image for clipboard instead of unicode characterGuillaume Gomez-0/+1
2021-05-04Add type to differentiate between fake and real DefId'sJustus K-1/+3
2021-04-22Remove unnecessary `edition` field on SharedContextJoshua Nelson-1/+1
2021-04-17Rollup merge of #84150 - jsha:defer-search-js, r=GuillaumeGomezDylan DPC-1/+2
rustdoc: move some search code into search.js This reduces main.s from 3094 lines to 1587. Also it saves some bytes of download in the case where search isn't used. There were a fair number of variables that needed to be accessible in both main.js and search.js, but I didn't want to put too many symbols in the global namespace, so I consolidated much of the search-related state and functions into a new object `window.searchState`. Demo at https://hoffman-andrews.com/rust/move-search/std/?search=foo
2021-04-17rustdoc: use more precise relative URLSMichael Howell-2/+1
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-04-13Split search.js from search-index.js.Jacob Hoffman-Andrews-2/+4
2021-04-12Move search JS into search-index.jsJacob Hoffman-Andrews-3/+2
Export a few variables and functions into the global scope because they are needed both by main.js and search-index.js.
2021-04-05Update Source Serif to release 4.004Trevor Spiteri-4/+4
Now the family name is Source Serif 4 (upstream issue 77) instead of Source Serif Pro.
2021-04-02Rollup merge of #83478 - jyn514:fine-grained-files, r=Mark-SimulacrumDylan DPC-121/+173
rustdoc: Add unstable option to only emit shared/crate-specific files The intended use case is for docs.rs, which can now copy exactly the files it cares about, rather than having to guess based on whether they have a resource suffix or not. In particular, some files have a resource suffix but cannot be shared between crates: https://github.com/rust-lang/docs.rs/pull/1312#issuecomment-798783688 The end goal is to fix rust-lang/docs.rs#1327 by reverting rust-lang/docs.rs#1324. This obsoletes `--print=unversioned-files`, which I plan to remove as soon as docs.rs stops using it. I recommend reviewing this one commit at a time. r? ``@GuillaumeGomez`` cc ``@Nemo157`` ``@pietroalbini``
2021-03-31Fix `--external-css` to be invocation-specific and note main.js should be ↵Joshua Nelson-1/+10
invocation specific
2021-03-31Rename CrateSpecific -> InvocationSpecificJoshua Nelson-7/+7
2021-03-31Enforce that Toolchain files are static and Crate files are dynamicJoshua Nelson-28/+35
This also changes custom themes from Toolchain to Crate files.
2021-03-25Add unstable option to only emit shared/crate-specific filesJoshua Nelson-11/+36
The intended use case is for docs.rs, which can now copy exactly the files it cares about, rather than having to guess based on whether they have a resource suffix or not. In particular, some files have a resource suffix but cannot be shared between crates: https://github.com/rust-lang/docs.rs/pull/1312#issuecomment-798783688 The end goal is to fix https://github.com/rust-lang/docs.rs/issues/1327 by reverting https://github.com/rust-lang/docs.rs/pull/1324. This obsoletes `--print=unversioned-files`, which I plan to remove as soon as docs.rs stops using it.
2021-03-25Add SharedResource abstraction and use it in write_sharedJoshua Nelson-103/+114
This cleans up the code quite a bit, and also makes the next commit much easier.
2021-03-24Rework rustdoc const typeGuillaume Gomez-1/+1
2021-03-23Rollup merge of #82732 - GuillaumeGomez:remove-theme-file, r=Nemo157Yuki Okushi-56/+5
Remove theme.js file Fixes #82616. The first commit moves the `theme.js` file into `main.js`, which requires to also run a small `.replace` on the `main.js` content. The second commit is just a small cleanup to centralize DOM ids. Since it removes a file from rustdoc output: cc `@rust-lang/docs-rs` cc `@jsha` r? `@jyn514`
2021-03-07Update Source Code Pro and include italicsTrevor Spiteri-2/+3
2021-03-05Add an unstable option to print all unversioned filesJoshua Nelson-18/+21
This allows sharing those files between different doc invocations without having to know their names ahead of time.
2021-03-05Store `UNVERSIONED_FILES` in a data structureJoshua Nelson-15/+21
This allows querying it programatically.
2021-03-05Remove theme.js file creation and move its code inside main.jsGuillaume Gomez-56/+5
2021-03-04Moved `write_shared` to its own fileNicholas-Baron-0/+542