about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2021-02-26Revert "Update normalize.css to 8.0.1"Guillaume Gomez-1/+1
2021-02-26Embed woff2 files in rustdoc binary.Jacob Hoffman-Andrews-0/+8
2021-02-26Add optional woff2 versions of FiraSans.Jacob Hoffman-Andrews-2/+6
For browsers that support woff2 (most modern ones: https://caniuse.com/woff2), this offers a reduction in download size for these two fonts from 362k to 257k (32% reduction). It decreases the total page size for `struct.String.html` (counting all subresources) by about 2.5%. If this is interesting, I'm happy to apply the same treatment to the other fonts, but these two are the biggest.
2021-02-26Auto merge of #78429 - casey:doctest-attribute-splitting, r=jyn514bors-7/+71
[librustdoc] Only split lang string on `,`, ` `, and `\t` Split markdown lang strings into tokens on `,`. The previous behavior was to split lang strings into tokens on any character that wasn't a `_`, `_`, or alphanumeric. This is a potentially breaking change, so please scrutinize! See discussion in #78344. I noticed some test cases that made me wonder if there might have been some reason for the original behavior: ``` t("{.no_run .example}", false, true, Ignore::None, true, false, false, false, v(), None); t("{.sh .should_panic}", true, false, Ignore::None, false, false, false, false, v(), None); t("{.example .rust}", false, false, Ignore::None, true, false, false, false, v(), None); t("{.test_harness .rust}", false, false, Ignore::None, true, true, false, false, v(), None); ``` It seemed pretty peculiar to specifically test lang strings in braces, with all the tokens prefixed by `.`. I did some digging, and it looks like the test cases were added way back in [this commit from 2014](https://github.com/rust-lang/rust/commit/3fef7a74ca9a) by `@skade.` It looks like they were added just to make sure that the splitting was permissive, and aren't testing that those strings in particular are accepted. Closes https://github.com/rust-lang/rust/issues/78344.
2021-02-25Rollup merge of #82484 - bugadani:docfix, r=jyn514Aaron Hill-1/+11
rustdoc: Remove duplicate "List of all items" Closes #82477 r? `@jyn514`
2021-02-25Rollup merge of #82313 - jsha:update-normalize-css, r=GuillaumeGomezDylan DPC-1/+1
Update normalize.css to 8.0.1 From From https://github.com/necolas/normalize.css/releases/tag/8.0.1. The old version was 3.0.0, from 2014. The new version is from 2018. I noticed when looking at frontend performance for rustdoc that this file was out of date. The URL in the 3.0.0 license header now resolves to an incorrect destination. And generally it seems good to be up-to-date. Before-and-after images, plus diff, under details. TL;DR: Nothing changes except a slight adjustment to line height. <details> ![with-normalize-8 0 1](https://user-images.githubusercontent.com/220205/108581849-bd5c8800-72e4-11eb-9150-78c8d67ca37a.png) ![with-normalize-3 0 0](https://user-images.githubusercontent.com/220205/108581848-bcc3f180-72e4-11eb-8b45-0cd1415a51e5.png) ![diff](https://user-images.githubusercontent.com/220205/108581890-dfeea100-72e4-11eb-93c5-6284492f54a9.png) </details>
2021-02-24Fix back-forward cache in rustdoc frontend.Jacob Hoffman-Andrews-6/+14
Rustdoc's frontend set a no-op unload handler, specifically to disable Firefox's back-forward cache because it caused a bug. It's nice to allow the back-forward cache because it permits faster navigations. This change addresses the issues that were caused by back-forward cache. https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/1.5/Using_Firefox_1.5_caching https://web.dev/bfcache/
2021-02-24Add testDániel Buga-0/+11
2021-02-24Remove duplicate stringDániel Buga-1/+0
2021-02-23Put clean::Trait extra information into a new struct to make it more coherentGuillaume Gomez-4/+4
2021-02-23Remove is_spotlight field from `Trait`Guillaume Gomez-4/+5
2021-02-23Fix nitsGuillaume Gomez-8/+4
2021-02-23Add --generate-redirect-map option to replace HTML redirection file with a ↵Guillaume Gomez-12/+49
unique JSON map
2021-02-23Rollup merge of #82234 - GuillaumeGomez:remove-query-param-on-esc, r=Nemo157Dylan DPC-1/+6
Remove query parameters when skipping search results Fixes #81330. This PR changes the following: when pressing ESC and that no other "action" was performed (understand: no closing the search result, or hiding a menu or something along the line), then we discard the URL query parameters (the `?whatever=dsjfs`). What do you think about this change ```@rust-lang/rustdoc``` ? EDIT: finally we're simply removing the query parameter when we're skipping the search results. r? ```@Nemo157```
2021-02-23Rollup merge of #79423 - camelid:smart-punct, r=jyn514Dylan DPC-6/+7
Enable smart punctuation Closes #76690.
2021-02-22Rollup merge of #82351 - notriddle:docs-meta-description, r=jyn514Yuki Okushi-1/+6
Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptions Partially addresses #82283.
2021-02-20Revert changes to all.htmlMichael Howell-6/+1
This code wasn't actually working, and trying to SEO optimize that page is pointless anyway.
2021-02-20Cut off plain text descriptions after headersMichael Howell-0/+2
Before: The Rust Standard LibraryThe Rust Standard Library is the foundation of portable Rust software, a set of minimal and battle-tested shared abstractions for the broader Rust ecosystem. It offers core types, like `Vec<T>` and `Option<T>`, library-defined operations on language primitives, standard macros, I/O and multithreading, among many other things. After: The Rust Standard Library
2021-02-20Use the first paragraph, instead of cookie-cutter text, for rustdoc descriptionsMichael Howell-2/+10
Fixes #82283
2021-02-20Don't render [src] link on dummy spansGuillaume Gomez-0/+3
2021-02-19Re-minify normalize.css.Jacob Hoffman-Andrews-349/+2
This bypasses tidy's complaints about tab indent. Also, this lets us remove comments while keeping the MIT license comment.
2021-02-19Update normalize.css to 8.0.1Jacob Hoffman-Andrews-232/+158
From https://github.com/necolas/normalize.css/releases/tag/8.0.1.
2021-02-19Replace normalize.css 3.0.0 with unminified version.Jacob Hoffman-Andrews-2/+423
This is in preparation to upgrade to 8.0.1, so the next commit can contain more meaningful diffs.
2021-02-17Remove query parameters when leaving search resultsGuillaume Gomez-1/+6
2021-02-16Make `Clean` take &mut DocContextJoshua Nelson-3/+3
- Take `FnMut` in `rustc_trait_selection::find_auto_trait_generics` - Take `&mut DocContext` in most of `clean` - Collect the iterator in auto_trait_impls instead of iterating lazily; the lifetimes were really bad. - Changes `fn sess` to properly return a borrow with the lifetime of `'tcx`, not the mutable borrow.
2021-02-15Fix ES5 errors (IE11)Guillaume Gomez-6/+12
2021-02-12[librustdoc] Reform lang string token splittingCasey Rodarmor-7/+71
Only split doctest lang strings on `,`, ` `, and `\t`. Additionally, to preserve backwards compatibility with pandoc-style langstrings, strip a surrounding `{}`, and remove leading `.`s from each token. Prior to this change, doctest lang strings were split on all non-alphanumeric characters except `-` or `_`, which limited future extensions to doctest lang string tokens, for example using `=` for key-value tokens. This is a breaking change, although it is not expected to be disruptive, because lang strings using separators other than `,` and ` ` are not very common
2021-02-10Fix getCurrentValueOphir LOJKINE-1/+1
2021-02-10Catch errors on localStorage setting failureOphir LOJKINE-23/+8
Fixes https://github.com/rust-lang/rust/issues/81928 “Ask forgiveness not permission” : this makes the code both simpler and more robust
2021-02-09Update Markdown unit testsCamelid-5/+5
2021-02-08Auto merge of #81313 - LeSeulArtichaut:revert-32558, r=jyn514bors-50/+8
Restore linking to itself in implementors section of trait page Reverts #32558 as proposed in [this Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Trait.20implementation.20self-links/near/223773273) r? `@jyn514` cc `@camelid`
2021-02-07Enable smart punctuationCamelid-1/+2
2021-02-06Auto merge of #80883 - GuillaumeGomez:remove-some-function-fields, r=ollie27bors-14/+139
Remove some function fields Same kind as #80845. This PR removes the `all_types` and `ret_types` from the `clean::Function` type. Another change that I had to do was implementing the `From` trait to be able to convert `hir::def::DefKind` into `clean::TypeKind` without requiring `DocContext` (and so I updated the `clean` method so that it's taken into account). The last two commits improve a bit the `get_real_types` function and the `Type::generics` method. r? `@jyn514`
2021-02-06Restore linking to itself in implementors section of trait pageLeSeulArtichaut-50/+8
2021-02-06Rollup merge of #81766 - jyn514:task-lists, r=GuillaumeGomezJonas Schievink-1/+4
Enable 'task list' markdown extension Closes https://github.com/rust-lang/rust/issues/71183.
2021-02-06Enable 'task list' markdown extensionJoshua Nelson-1/+4
- Add documentation about task lists
2021-02-05Remove unused cache argumentGuillaume Gomez-12/+9
2021-02-05Improve codeGuillaume Gomez-1/+1
2021-02-05Improve html::render::cache::get_real_types codeGuillaume Gomez-3/+125
2021-02-05Remove Function all_types and ret_types fieldsGuillaume Gomez-14/+20
2021-02-05Rollup merge of #81497 - camelid:rustdoc-display_fn-remove-cell, r=jyn514Mara Bos-11/+11
rustdoc: Move `display_fn` struct inside `display_fn` This makes it clear that it's an implementation detail of `display_fn` and shouldn't be used elsewhere, and it enforces in the compiler that no one else can use it. r? ````@GuillaumeGomez````
2021-02-03Rollup merge of #81681 - Smittyvb:rustdoc-shortcuts-styling, r=GuillaumeGomezGuillaume Gomez-2/+2
Better styling of "Switch result tab" shortcut Before: ![](https://user-images.githubusercontent.com/10530973/106663877-544de400-6572-11eb-98a4-77b6b3d9cd42.png) ![image](https://user-images.githubusercontent.com/10530973/106664790-8d3a8880-6573-11eb-811f-29c4ade31848.png) After: ![](https://user-images.githubusercontent.com/10530973/106663945-6b8cd180-6572-11eb-911a-12c69d935ee5.png) ![](https://user-images.githubusercontent.com/10530973/106664403-05547e80-6573-11eb-84bf-fdd0dfc7dac8.png)
2021-02-03Rollup merge of #81679 - GuillaumeGomez:clean-fixme-match-bind, ↵Guillaume Gomez-2/+10
r=poliorcetics,CraftSpider Bind all clean::Type variants and remove FIXME This is simply a little cleanup. cc `@CraftSpider` r? `@poliorcetics`
2021-02-02Better styling of "Switch result tab" shortcutSmitty-2/+2
2021-02-02Bind all clean::Type variants and remove FIXMEGuillaume Gomez-2/+10
2021-02-02Rollup merge of #81630 - GuillaumeGomez:overflow-sidebar-title-text, r=pickfireJonas Schievink-0/+8
Fix overflowing text on mobile when sidebar is displayed Fixes #81597. Before: ![Screenshot from 2021-02-01 17-21-15](https://user-images.githubusercontent.com/3050060/106486857-610b0300-64b2-11eb-96d3-12b939f5b661.png) After: ![Screenshot from 2021-02-01 17-20-59](https://user-images.githubusercontent.com/3050060/106486840-5cdee580-64b2-11eb-9492-4df27bb39e59.png) cc `@pickfire` r? `@Nemo157`
2021-02-02Rollup merge of #81492 - camelid:rustdoc-internal-mod-vis, r=GuillaumeGomezJonas Schievink-0/+1
rustdoc: Note why `rustdoc::html::markdown` is public 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. r? ``@GuillaumeGomez``
2021-02-02Auto merge of #81557 - GuillaumeGomez:primitive-search, r=ollie27bors-1/+1
Fix primitive search in parameters and returned values Part of #60485. Fixes #74780. Replacing #74879. cc `@camelid` `@jyn514` `@CraftSpider` r? `@ollie27`
2021-02-01Fix overflowing text on mobile when sidebar is displayedGuillaume Gomez-0/+8
2021-02-01Put back primitives in searchGuillaume Gomez-1/+1