about summary refs log tree commit diff
path: root/src/librustdoc/html/static
AgeCommit message (Collapse)AuthorLines
2021-11-24Fix clicking on anchors inside summary tags.Jacob Hoffman-Andrews-1/+1
2021-11-24Fix more <a> colorGuillaume Gomez-0/+6
2021-11-23Rollup merge of #91103 - jsha:non-toggle-click-doesnt-toggle, ↵Matthias Krüger-0/+8
r=Manishearth,GuillaumeGomez Inhibit clicks on summary's children A byproduct of using `<details>` and `<summary>` to show/hide detailed documentation was that clicking any part of a method heading (or impl heading) would show or hide the documentation. This was not super noticeable because clicking a link inside the method heading would navigate to that link. But clicking any unlinked black text in a method heading would trigger the behavior. That behavior was somewhat unexpected, and means that if you try to click a type name in a method heading, but miss by a few pixels, you get a confusing surprise. This change inhibits that behavior by putting an event listener on most summaries that cancels the event unless the event target was the summary itself. In practice, that means it cancels the event unless the target was the "[+]" / "[-]", because the rest of the heading is wrapped inside a `<div>`, which is the target for anything that doesn't have a more specific target. r? ``@Manishearth``
2021-11-22Rollup merge of #91102 - jsha:theme-anchor, r=GuillaumeGomezMatthias Krüger-28/+39
Set color for <a> in a more straightforward way. Previously, we set the default color for <a> tags to black, and then had an override with a bunch of not() clauses to set anchors in docblocks to blue. Instead, we should set the default color for <a> to blue (or equivalent in other themes), and override it for places like the sidebar or search results, where we don't want them to be styled as links. Demo at https://rustdoc.crud.net/jsha/theme-anchor/std/string/struct.String.html. This should result in no visible changes. r? `@GuillaumeGomez`
2021-11-22Auto merge of #91099 - jsha:cleanup-undocumented, r=GuillaumeGomezbors-33/+4
Remove styles for details.undocumented The Rust code that generated tags with that class was deleted in 10bafe1975e53769180701508e2b8cd3a3b34a0e. r? `@GuillaumeGomez`
2021-11-22Add GUI test for clicking on non-toggle summaryJacob Hoffman-Andrews-1/+1
2021-11-22Set color for <a> in a more straightforward wayJacob Hoffman-Andrews-28/+39
Previously, we set the default color for <a> tags to black, and then had an override with a bunch of not() clauses to set anchors in docblocks to blue. Instead, we should set the default color for <a> to blue (or equivalent in other themes), and override it for places like the sidebar or search results, where we don't want them to be styled as links.
2021-11-21Inhibit clicks on summary's childrenJacob Hoffman-Andrews-0/+8
A byproduct of using `<details>` and `<summary>` to show/hide detailed documentation was that clicking any part of a method heading (or impl heading) would show or hide the documentation. This was not super noticeable because clicking a link inside the method heading would navigate to that link. But clicking any unlinked black text in a method heading would trigger the behavior. That behavior was somewhat unexpected, and means that if you try to click a type name in a method heading, but miss by a few pixels, you get a confusing surprise. This change inhibits that behavior by putting an event listener on most summaries that cancels the event unless the event target was the summary itself. In practice, that means it cancels the event unless the target was the "[+]" / "[-]", because the rest of the heading is wrapped inside a `<div>`, which is the target for anything that doesn't have a more specific target.
2021-11-20Remove styles for details.undocumentedJacob Hoffman-Andrews-33/+4
The Rust code that generated tags with that class was deleted in 10bafe1975e53769180701508e2b8cd3a3b34a0e.
2021-11-20Rollup merge of #90983 - GuillaumeGomez:sidebar-scrollbar, r=jshaMatthias Krüger-4/+4
Make scrollbar in the sidebar always visible for visual consistency Fixes #90943. I had to add a background in `dark` and `ayu` themes, otherwise it was looking strange (like an invisible margin). So it looks like this: ![Screenshot from 2021-11-17 14-45-49](https://user-images.githubusercontent.com/3050060/142212476-18892ae0-ba4b-48e3-8c0f-4ca1dd2f851d.png) ![Screenshot from 2021-11-17 14-45-53](https://user-images.githubusercontent.com/3050060/142212482-e97b2fad-68d2-439a-b62e-b56e6ded5345.png) Sadly, I wasn't able to add a GUI test to ensure that the scrollbar was always displayed because it seems not possible in puppeteer for whatever reason... I used this method: on small pages (like `lib2/sub_mod/index.html`), comparing `.navbar`'s `clientWidth` with `offsetWidth` (the first doesn't include the sidebar in the computed amount). When checking in the browser, it works fine but in puppeteer it almost never works... In case anyone want to try to solve the bug, here is the puppeteer code: <details> More information about this: I tried another approach which was to get the element in `evaluate` directly (by calling it from `page.evaluate(() => { .. });` directly instead of `parseAssertElemProp.evaluate(e => {...});`. ```js const puppeteer = require('puppeteer'); (async () => { const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto("file:///path/rust/build/x86_64-unknown-linux-gnu/test/rustdoc-gui/doc/lib2/sub_mod/index.html"); await page.waitFor(".sidebar"); let parseAssertElemProp = await page.$(".sidebar"); if (parseAssertElemProp === null) { throw '".sidebar" not found'; } await parseAssertElemProp.evaluate(e => { const parseAssertElemPropDict = {"clientWidth": "192", "offsetWidth":"200"}; for (const [parseAssertElemPropKey, parseAssertElemPropValue] of Object.entries(parseAssertElemPropDict)) { if (e[parseAssertElemPropKey] === undefined || String(e[parseAssertElemPropKey]) != parseAssertElemPropValue) { throw 'expected `' + parseAssertElemPropValue + '` for property `' + parseAssertElemPropKey + '` for selector `.sidebar`, found `' + e[parseAssertElemPropKey] + '`'; } } }).catch(e => console.error(e)); await browser.close(); })(); ``` </details> r? ``@jsha``
2021-11-20Reduce prominence of item-infosJacob Hoffman-Andrews-3/+1
- Remove border. - Reduce size of emoji slightly. - Remove details disclosure for unstable reason. This was inconsistent with our other details disclosures, and the detail revealed was usually better explained by clicking on the issue link.
2021-11-20Rollup merge of #90089 - jsha:enum-fields-headings, r=camelid,GuillaumeGomezMatthias Krüger-13/+16
Improve display of enum variants Use h3 and h4 for the variant name and the "Fields" subheading. Remove the "of T" part of the "Fields" subheading. Remove border-bottom from "Fields" subheading. Move docblock below "Fields" listing. Fixes #90061 Demo: https://jacob.hoffman-andrews.com/rust/xmlparser-updated/xmlparser/enum.Token.html#variants https://jacob.hoffman-andrews.com/rust/fix-enum-variants/std/io/enum.ErrorKind.html#variants https://jacob.hoffman-andrews.com/rust/fix-enum-variants/std/result/enum.Result.html#variants r? ``@camelid``
2021-11-17Make scrollbar in the sidebar always visible for visual consistencyGuillaume Gomez-4/+4
2021-11-04Fix missing bottom border for headings in sidebarGuillaume Gomez-3/+9
2021-10-31Hide search bar in noscript.cssJacob Hoffman-Andrews-13/+12
Also, remove the highlighting of the search bar in disabled state. This reduces flicker when loading a page.
2021-10-30Improve display of enum variantsJacob Hoffman-Andrews-13/+16
Use h3 and h4 for the variant name and the "Fields" subheading. Remove the "of T" part of the "Fields" subheading. Remove border-bottom from "Fields" subheading. Move docblock below "Fields" listing.
2021-10-30Rollup merge of #90156 - jsha:less-border-bottom-2, r=GuillaumeGomezGuillaume Gomez-2/+9
Remove underlines from non-top docblocks. We still had a number of places where underlined section headings would show up, like under Implementations. Follow-up to #89506 (thanks `@yaymukund!)` and #90036. Related to #59829. r? `@camelid` Demo: [Before](https://doc.rust-lang.org/nightly/std/string/struct.String.html#trait-implementations): [![image](https://user-images.githubusercontent.com/220205/138402555-b0c0a3ea-ff50-4aad-bb74-6f9e57323807.png)](https://jacob.hoffman-andrews.com/rust/less-border-bottom-2/std/string/struct.String.html#trait-implementations) [After](https://jacob.hoffman-andrews.com/rust/less-border-bottom-2/std/string/struct.String.html#trait-implementations): [![image](https://user-images.githubusercontent.com/220205/138402669-d0835bd9-8813-4f0c-8697-f86e9759acec.png)](https://jacob.hoffman-andrews.com/rust/less-border-bottom-2/std/string/struct.String.html#trait-implementations)
2021-10-30Remove underlines from non-top docblocks.Jacob Hoffman-Andrews-2/+9
We still had a number of places where underlined section headings would show up, like under Implementations.
2021-10-29Fix invalid handling of genericsGuillaume Gomez-13/+24
2021-10-27Rollup merge of #90232 - konan8205:master, r=GuillaumeGomezMatthias Krüger-9/+15
rustdoc: Use TTF based font instead of OTF for CJK glyphs to improve readability Due to Windows' implementation of font rendering, OpenType fonts can be distorted. So the existing font, Noto Sans KR, is not very readable on Windows. This PR improves readability of Korean glyphs on Windows. ## Before ![원1](https://user-images.githubusercontent.com/11029378/138592394-16b15787-532d-4421-a5eb-ed85675290fa.png) ## After ![원2](https://user-images.githubusercontent.com/11029378/138592409-f3a440ee-f0fc-40e4-9561-42c479439c9f.png) The fonts included in this PR are licensed under the SIL Open Font License and generated with these commands: ```sh pyftsubset NanumBarunGothic.ttf \ --unicodes=U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF \ --output-file=NanumBarunGothic.ttf.woff --flavor=woff ``` ```sh pyftsubset NanumBarunGothic.ttf \ --unicodes=U+AC00-D7AF,U+1100-11FF,U+3130-318F,U+A960-A97F,U+D7B0-D7FF \ --output-file=NanumBarunGothic.ttf.woff2 --flavor=woff2 ``` r? ``@GuillaumeGomez``
2021-10-26rustdoc: use ttf based font for cjk glyphsShinwoo Park-9/+15
2021-10-25Fix scrollbars appearing on information tooltip on mac when they shouldn'tGuillaume Gomez-1/+1
2021-10-24Rollup merge of #90155 - jsha:outdent-methods, r=GuillaumeGomez,camelidMatthias Krüger-18/+10
Fix alignment of method headings for scannability We sometimes use indentation to indicate something is a heading: The section that comes after is indented by 24px relative to the heading. However, the relationship between the "Implementations" section heading, the `impl` headings it contains, and the `pub fn` subheadings within each impl, is awkward. It goes **Implementations**, 15px indent, `impl`, 5px indent, `pub fn`, 4px indent, docblock. I line up `impl` and `pub fn` with the `Implementations` heading, give `impl` a larger font size to indicate it is higher in the hierarchy, and indent the docblock a full 24px relative to their parent, matching the indents we use elsewhere to distinguish section headings. By letting the `pub fn` stick out to the left of the docblock, I think this makes methods significantly more scannable. Related to #59829 r? `````@camelid````` [Old](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations): [![image](https://user-images.githubusercontent.com/220205/138380233-9c63a0f2-0f80-40a3-ab3d-a1ee9fb7c5d8.png)](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations) [New](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations): [![image](https://user-images.githubusercontent.com/220205/138392479-b45fce3f-bf43-42e0-81ee-c4bb9ac35cda.png)](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations)
2021-10-23Outdent method headings so they stand outJacob Hoffman-Andrews-18/+10
The makes the heading / documentation distinction clearer.
2021-10-23Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514Matthias Krüger-0/+292
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-19Small scrape-example fixesWill Crichton-1/+6
2021-10-20Rollup merge of #90036 - jsha:less-rule, r=GuillaumeGomezYuki Okushi-5/+8
Remove border-bottom from most docblocks. Headings in the top-doc docblock still get a border-bottom due to a rule that covers all h2, h3, and h4. Method docblocks are generally h5, and so don't get a border-bottom anymore. This fixes a problem where a sub-sub-heading within a method would have a line that went all the way across the page, creating a division that made that sub-sub-heading look much more important than it really is. Fixes #90033 Demo at https://jacob.hoffman-andrews.com/rust/less-rule/std/string/struct.String.html r? ``@GuillaumeGomez``
2021-10-20Rollup merge of #90018 - GuillaumeGomez:too-long-item-names, r=jshaYuki Okushi-4/+8
Fix rustdoc UI for very long type names Fixes #89972. While working on it, I also discovered that when the item name is too long, it also breaks the flow of the page. To make things right, I also renamed the `type-decl` CSS class into `item-decl` (because this PR also generates it for more than type declarations). So here are the before/after screenshots: ![Screenshot from 2021-10-18 16-58-03](https://user-images.githubusercontent.com/3050060/137757247-637fcf04-4406-49c6-8a8a-18c2074aacd9.png) ![Screenshot from 2021-10-18 16-58-26](https://user-images.githubusercontent.com/3050060/137757252-17935e63-53b3-449f-a535-7be91ff0e257.png) ![Screenshot from 2021-10-18 16-58-07](https://user-images.githubusercontent.com/3050060/137757278-8b12e348-2980-4fc4-8853-bef99d58981f.png) ![Screenshot from 2021-10-18 16-58-28](https://user-images.githubusercontent.com/3050060/137757282-534a0e1b-3016-49ba-b3ac-e45bdb9035cb.png) r? ``@jsha``
2021-10-18Reduce margin on h5 and h6Jacob Hoffman-Andrews-1/+8
2021-10-18Remove border-bottom from most docblocks.Jacob Hoffman-Andrews-4/+0
Headings in the top-doc docblock still get a border-bottom due to a rule that covers all h2, h3, and h4. Method docblocks are generally h5, and so don't get a border-bottom anymore. This fixes a problem where a sub-sub-heading within a method would have a line that went all the way across the page, creating a division that made that sub-sub-heading look much more important than it really is.
2021-10-18Prevent documentation page title to grow too bigGuillaume Gomez-0/+1
2021-10-18* Remove left margin on items declaration at the top of their documentation pageGuillaume Gomez-4/+7
* Rename "type-decl" into "item-decl" to reflect the change of usage
2021-10-12rustdoc: update noto sans krShinwoo Park-3/+4
2021-10-11Cleanup .item-table CSSStefan Schindler-1/+1
2021-10-11Rollup merge of #89736 - GuillaumeGomez:rm-unused-css-rule, r=dns2utf8Matthias Krüger-2/+0
Remove unused CSS rule As you can see in the firefox devtools: ![Screenshot from 2021-10-10 14-28-08](https://user-images.githubusercontent.com/3050060/136695689-16c77ceb-b1ab-40df-963a-048f2258e217.png) It needs the display to be `grid` or `inline-grid`, which isn't the case. r? `@dns2utf8`
2021-10-10Remove unused CSS ruleGuillaume Gomez-2/+0
2021-10-10Fix <code> blocks in doc blocks display on mobileGuillaume Gomez-0/+4
2021-10-08Move more scrape-examples logic from JS to rustWill Crichton-33/+14
Fix failing test Add missing backslash Fix padding issue with horizontal scrollbar
2021-10-07Move some expansion logic into generation-time, fix section header links, ↵Will Crichton-13/+11
remove ID from line numbers, fix horizontal scrolling on non-expanded elements
2021-10-06Update to latest rustc and rustdoc stylesWill Crichton-4/+4
2021-10-06Fix lint error, change scrape-examples.js minify callWill Crichton-0/+2
2021-10-06Move JS into a standalone fileWill Crichton-115/+110
2021-10-06Incorporate jyn's feedbackWill Crichton-4/+25
* Move call location logic from function constructor to rendering * Fix issue with macro spans in scraping examples * Clean up example loading logic Documentation / newtype for DecorationInfo Fix line number display Serialize edition of call site, other small cleanup
2021-10-06Add styles for non-white themesWill Crichton-1/+47
Tweak colors Tabs New link heading style
2021-10-06Reduce blur size, fix example width bug, add better error handling for I/O ↵Will Crichton-4/+9
issues Remove repository url Fix formatting Fix file_span in print_src Formatting
2021-10-06Move highlighting logic from JS to RustWill Crichton-133/+44
Continue migrating JS functionality Cleanup Fix compile error Clean up the diff Set toggle font to sans-serif
2021-10-06Sort examples by sizeWill Crichton-18/+69
Improve styling Start to clean up code, add comments
2021-10-06Generate example source files with corresponding linksWill Crichton-1/+1
Add display name Fix remaining merge conflicts Only embed code for items containing examples
2021-10-06Factor scraping and rendering into separate calls to rustdocWill Crichton-52/+16
Simplify toggle UI logic, add workspace root for URLs
2021-10-06Fix check issueWill Crichton-7/+17
Clean up tidy checks