summary refs log tree commit diff
path: root/src/librustdoc/html/render/write_shared.rs
AgeCommit message (Collapse)AuthorLines
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