summary refs log tree commit diff
path: root/src/librustdoc/html/templates
AgeCommit message (Collapse)AuthorLines
2023-06-27Replace `id` attribute with `name` for `<meta>` tagGuillaume Gomez-1/+1
2023-06-27Fix invalid HTML DIV tag used in HEADGuillaume Gomez-2/+1
2023-06-23Link to the corresponding channel in the help popoverGuillaume Gomez-0/+1
2023-06-21Fix union fields displayGuillaume Gomez-8/+9
2023-06-11Add `item_template` macroNicky Lim-4/+4
2023-05-25Add `ItemTemplate` traitNicky Lim-4/+4
2023-05-02Avoid ICEing miri on layout query cyclesOli Scherer-44/+49
2023-04-22Rollup merge of #109949 - notriddle:notriddle/type-layout, r=jshaYuki Okushi-0/+65
rustdoc: migrate `document_type_layout` to askama
2023-04-18rustdoc: format type layout template with newline after `<p>`Michael Howell-8/+16
2023-04-18rustdoc: create variants list outside of templateMichael Howell-7/+7
2023-04-18rustdoc: use a separate template for type layout sizeMichael Howell-0/+12
2023-04-12Move creation of `theme.css` file from `--extend-css` command into the ↵Guillaume Gomez-1/+1
`static.files` folder
2023-04-08rustdoc: migrate `document_type_layout` to askamaMichael Howell-0/+45
2023-04-08Auto merge of #109925 - notriddle:notriddle/item-union, r=GuillaumeGomezbors-0/+23
rustdoc: migrate item_union to an Askama template
2023-04-05rustdoc: avoid including line numbers in Google SERP snippetsMichael Howell-2/+4
2023-04-05rustdoc: migrate `item_union` to an Askama templateMichael Howell-0/+23
2023-03-23Rollup merge of #109187 - clubby789:askama-source, r=GuillaumeGomezDylan DPC-0/+19
Render source page layout with Askama ~~I was looking at making `code_html` render into the buffer instead of in advance, but it turned out to need a pretty big refactor, so starting with rearranging the high-level layout.~~ Found another approach which required much less changes cc #108868
2023-03-21Add `safe` to number renderingclubby789-2/+2
2023-03-20Fix improper escaping of deprecation reasonsclubby789-1/+1
2023-03-16Fix invalid markdown link referencesDaniPopes-7/+7
2023-03-16Render source page layout with Askamaclubby789-0/+19
Co-authored-by: Michael Howell <michael@notriddle.com>
2023-03-11Rollup merge of #108784 - clubby789:askama-sidebar, r=jsha,GuillaumeGomezMatthias Krüger-0/+37
rustdoc: Migrate sidebar rendering to Askama cc #108757 Renders the sidebar for documentation using an Askama template
2023-03-11Rollup merge of #108757 - clubby789:askama-move, r=notriddle,jsha,GuillaumeGomezMatthias Krüger-0/+30
rustdoc: Migrate `document_item_info` to Askama https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/rustdoc.20allocations.20are.20slow Hoping to piece-by-piece migrate things to template. Had a few failed attempts at more complex parts of the code, so this is just a start.
2023-03-10Render doc sidebar using Askamaclubby789-0/+37
2023-03-10Migrate `document_item_info` to templatesclubby789-0/+30
2023-03-08Only load one CSS theme by defaultMichael Howell-18/+21
To avoid generating a FOUC at startup, this commit uses `document.write` to load the stylesheet initially. Co-Authored-By: Guillaume Gomez <guillaume1.gomez@gmail.com>
2023-03-06Update documentation for HTML templates styleGuillaume Gomez-13/+14
2023-03-06Remove unneeded minus sign in jinja tagsGuillaume Gomez-173/+173
2023-02-07Rollup merge of #107471 - notriddle:notriddle/default-settings, r=GuillaumeGomezMatthias Krüger-0/+2
rustdoc: do not include empty default-settings tag in HTML
2023-01-30rustdoc: remove meta keywords from HTMLMichael Howell-1/+0
Discussed in <https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60.3Cmeta.20name.3D.22keywords.22.3E.60>
2023-01-30rustdoc: do not include empty default-settings tag in HTMLMichael Howell-0/+2
2023-01-27rustdoc: remove inline javascript from copy-path buttonMichael Howell-1/+1
2023-01-13rustdoc: remove unnecessary DOM class `h1.fqn`Michael Howell-1/+1
It's misleading. The main heading sometimes isn't an fully qualified name at all. It's also redundant. It's always a child of `div.main-heading`, so just use that.
2023-01-04rustdoc: remove unnecessary wrapper around sidebar and mobile logosMichael Howell-16/+12
This commit changes `.sidebar a:hover:not(.logo-container)` to add the `:not()` pseudo-class, retaining the old appearance of the logo when mousing over it. This didn't used to be necessary because the `a.sidebar-logo` was `display:inline`, and was what got the `background` changed on hover, while the `div.logo-container` inside it was `display:block`. This resulted in the hover rule not having any effect, because the logo-container box was not actually nested inside the sidebar-logo box: https://www.w3.org/TR/CSS2/visuren.html#anonymous-block-level > When an inline box contains an in-flow block-level box, the inline box (and its inline ancestors within the same line box) are broken around the block-level box (and any block-level siblings that are consecutive or separated only by collapsible whitespace and/or out-of-flow elements), splitting the inline box into two boxes (even if either side is empty), one on each side of the block-level box(es). The line boxes before the break and after the break are enclosed in anonymous block boxes, and the block-level box becomes a sibling of those anonymous boxes. When such an inline box is affected by relative positioning, any resulting translation also affects the block-level box contained in the inline box.
2022-12-19rustdoc: remove width-limiter from source pages, stop overriding CSSMichael Howell-2/+2
2022-11-23Improve accessibility:Guillaume Gomez-0/+1
* Set aria-label attribute on search input * Put anchor text directly into the DOM and not in the CSS
2022-11-19rustdoc: fix scrape-examples JS pathMichael Howell-1/+1
2022-11-05Rollup merge of #101702 - jsha:static-files2, r=notriddle,GuillaumeGomezMatthias Krüger-29/+29
rustdoc: add hash to filename of toolchain files All static files used by rustdoc are now stored in static.files/ and their filenames include a hash of their contents. Their filenames no longer include the contents of the --resource-suffix flag. This clarifies caching semantics. Anything in static.files can use Cache-Control: immutable because any updates will show up as a new URL. Invocation-specific files like crates-NN.js, search-index-NN.js, and sidebar-items-NN.js still get the resource suffix. This has a useful side effect: once toolchain files aren't affected by resource suffix, it will become possible for docs.rs to include crate version in the resource suffix. That should fix a caching issue with `/latest/` URLs: https://github.com/rust-lang/docs.rs/issues/1593. My goal is that it should be safe to serve all rustdoc JS, CSS, and fonts with infinite caching headers, even when new versions of a crate are uploaded in the same place as old versions. The --disable-minification flag is removed because it would vary the output of static files based on invocation flags. Instead, for rustdoc development purposes it's preferable to symlink static files to a non-minified copy for quick iteration. Example listing: ``` $ cd build/x86_64-unknown-linux-gnu/doc/ && find . | egrep 'js$|css$' | egrep -v 'sidebar-items|implementors' | sort ./crates1.65.0.js ./rust.css ./search-index1.65.0.js ./source-files1.65.0.js ./static.files/ayu-2bfd0af01c176fd5.css ./static.files/dark-95d11b5416841799.css ./static.files/light-c83a97e93a11f15a.css ./static.files/main-efc63f77fb116394.js ./static.files/normalize-76eba96aa4d2e634.css ./static.files/noscript-5bf457055038775c.css ./static.files/rustdoc-7a422337900fa894.css ./static.files/scrape-examples-3dd10048bcead3a4.js ./static.files/search-47f3c289722672cf.js ./static.files/settings-17b08337296ac774.js ./static.files/settings-3f95eacb845293c0.css ./static.files/source-script-215e9db86679192e.js ./static.files/storage-26d846fcae82ff09.js ``` Fixes #98413
2022-10-30Rollup merge of #101944 - notriddle:notriddle/toggle-all-docs, ↵Michael Howell-3/+3
r=jsha,GuillaumeGomez rustdoc: clean up `#toggle-all-docs` This change converts the element from an `<a>` link to a button. It's pretty much directly trading slightly more CSS for slightly less HTML, and it's also semantically correct (so you don't get a broken "bookmark" option when you right click on it). While doing this, I also got rid of the unnecessary `class="inner"` attribute on the inner span. There was a style targeting `.collapse-toggle > .inner`, but no CSS ever targeted the `#toggle-all-docs > .inner`. Preview: https://notriddle.com/notriddle-rustdoc-test/button-toggle-all-docs/index.html
2022-10-29rustdoc: add hash to filename of toolchain filesJacob Hoffman-Andrews-29/+29
All static files used by rustdoc are now stored in static.files/ and include a hash of their contents. They no longer include the contents of the --resource-suffix flag. This clarifies caching semantics. Anything in static.files can use Cache-Control: immutable because any updates will show up as a new URL. Invocation-specific files like crates-NN.js, search-index-NN.js, and sidebar-items-NN.js still get the resource suffix. The --disable-minification flag is removed because it would vary the output of static files based on invocation flags. Instead, for rustdoc development purposes it's preferable to symlink static files to a non-minified copy for quick iteration.
2022-10-27rustdoc: remove redundant `div.search-container`Michael Howell-18/+16
This wrapper DIV was originally added in 89e1fb322321c05497caa01372ceb7d5b57fa680, when it allowed the search bar's size to be calculated without using `calc()`. This `width` hack can be removed using flexbox.
2022-10-24rustdoc: clean up `#toggle-all-docs`Michael Howell-3/+3
This change converts the element from an `<a>` link to a button. It's pretty much directly trading slightly more CSS for slightly less HTML, and it's also semantically correct (so you don't get a broken "bookmark" option when you right click on it). While doing this, I also got rid of the unnecessary `class="inner"` attribute on the inner span. There was a style targeting `.collapse-toggle > .inner`, but no CSS ever targeted the `#toggle-all-docs > .inner`.
2022-10-24rustdoc: remove unused `.sidebar-logo` DOM on source pagesMichael Howell-0/+2
2022-10-20rustdoc: improve appearance of source page navigation barMichael Howell-24/+22
This commit changes things so that the search bar is exactly centered between the top of the page and the top of the source code content area.
2022-10-18rustdoc: remove class name `location` from sidebar sibling navMichael Howell-1/+1
This change tweaks the CSS to apply most of its styles to `.sidebar h2`, cleaning up a few redundant rules from `.mobile-topbar .location` and restoring useful navigation aids in mobile mode.
2022-10-16rustdoc: remove unused `.sub-logo-container` DOM on non-source pagesMichael Howell-0/+2
2022-10-15rustdoc: make the help button a link to a pageMichael Howell-1/+1
This allows you to open the help section in a new browser tab, which is a pretty reasonable thing to want for a documentation page.
2022-10-08rustdoc: remove mobile topbar from source pages instead of hiding itMichael Howell-0/+2
2022-10-05rustdoc: remove unused CSS class `in-band`Michael Howell-13/+11
Since a7c25b29575c17434406b69773f8c2961af343b3 removed `in-band` from code headers, the only remaining uses of the `in-band` class are: https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/write_shared.rs#L520-L521 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/templates/print_item.html#L2-L3 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/context.rs#L637-L638 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L368-L369 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/render/mod.rs#L401-L402 https://github.com/rust-lang/rust/blob/02cd79afb8080fce8c8ce35533c54d8ecf8f390e/src/librustdoc/html/static/js/main.js#L525 Since all of these uses are nested below `h1.fqn`, we can get rid of it, and the support code that was used for when `in-band` was part of item rendering.
2022-08-25rustdoc: remove `type="text/css" from stylesheet linksMichael Howell-4/+4
MDN directly recommends this in <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link>, since "CSS is the only stylesheet language used on the web."