about summary refs log tree commit diff
path: root/src/librustdoc/html/static/css/rustdoc.css
AgeCommit message (Collapse)AuthorLines
2021-11-24Consistentize the system for image URLs in CSS.Jacob Hoffman-Andrews-0/+11
2021-11-24Rollup merge of #91075 - jsha:chill-item-info, r=GuillaumeGomezGuillaume Gomez-3/+1
Reduce prominence of item-infos Fixes #59853 - 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. Demo: https://rustdoc.crud.net/jsha/chill-item-info/std/mem/union.MaybeUninit.html#method.slice_assume_init_ref Compare vs: https://doc.rust-lang.org/nightly/std/mem/union.MaybeUninit.html#method.slice_assume_init_ref <img src="https://user-images.githubusercontent.com/220205/142717815-09828c9e-6ff4-445a-8ccc-31e028fd4985.png" width=700>
2021-11-22Rollup merge of #91102 - jsha:theme-anchor, r=GuillaumeGomezMatthias Krüger-4/+0
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-22Set color for <a> in a more straightforward wayJacob Hoffman-Andrews-4/+0
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-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-1/+1
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-1/+1
2021-11-04Fix missing bottom border for headings in sidebarGuillaume Gomez-1/+2
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-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-27Rollup merge of #90232 - konan8205:master, r=GuillaumeGomezMatthias Krüger-6/+6
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-6/+6
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/+168
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-1/+5
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-1/+4
* 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-0/+1
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-4/+8
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-06Incorporate jyn's feedbackWill Crichton-4/+0
* 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/+9
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-9/+13
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-9/+49
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-8/+5
Simplify toggle UI logic, add workspace root for URLs
2021-10-06Fix check issueWill Crichton-1/+2
Clean up tidy checks
2021-10-06Add updated support for example-analyzerWill Crichton-0/+107
Move rendering of examples into Finalize design Cleanup, rename found -> scraped Softer yellow Clean up dead code Document scrape_examples More simplification and documentation Remove extra css Test
2021-10-06Rollup merge of #89506 - yaymukund:docblock-headings, r=GuillaumeGomezManish Goregaokar-10/+9
librustdoc: Use correct heading levels. Closes #89309 This fixes the `<h#>` header tags throughout the docs to reflect a semantic hierarchy. - I ran a script to manually check that we don't have any files with multiple `<h1>` tags. - Also checked that we never incorrectly nest e.g. a `<h2>` under an `<h3>`. - I also spot-checked a bunch of pages (`trait.Read`, `enum.Ordering`, `primitive.isize`, `trait.Iterator`).
2021-10-04librustdoc: Use correct heading levels.Mukund Lakshman-10/+9
- Avoid multiple <h1>s on a page. - The <h#> tags should follow a semantic hierarchy. - Cap at h6 (no h7)
2021-10-03Move from grid layout to table based layout because of browser limits that ↵Stefan Schindler-10/+9
overlay row entries after a UA specific amount of rows
2021-09-17Add rustdoc version into the help popupGuillaume Gomez-3/+12
2021-09-08Wrap <table> elements into <div> to prevent breaking layout and widthGuillaume Gomez-0/+5
2021-08-19Rollup merge of #88093 - Kobzol:rustdoc-wrap-code-in-code-tag, r=GuillaumeGomezGuillaume Gomez-1/+0
[rustdoc] Wrap code blocks in <code> tag This PR modifies Rustdoc output so that fenced code snippets, items and whole file source codes are wrapped in `<pre><code>` instead of just `<pre>`. This should improve the semantic meaning of the generated content. I'm not sure what to do about `render_attributes_in_pre` and `render_attributes_in_code`. These functions were clearly expected to be used for things inside `<pre>` or `<code>`, and since I added `<code>` in this PR, some of them will be used in a different context than before. However, it seems to me that even before they were not consistent. For example, `item_constant` used `render_attributes_in_code` for its attributes, however there was no `<code>` used for constants before this PR... Should I create some `rustdoc-gui` tests? For example to check that all `<pre>` tags have a `<code>` child? Fixes: https://github.com/rust-lang/rust/issues/88020
2021-08-19[rustdoc] Wrap code blocks in <code> tagJakub Beránek-1/+0