about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2020-07-14rustdoc: glue tokens before highlightingAndy Russell-22/+133
Fixes #72684. This commit also modifies the signature of `Classifier::new` to avoid copying the source being highlighted.
2020-07-14Rollup merge of #71237 - Cldfire:rustdoc-ayu-theme, r=GuilliaumeGomezManish Goregaokar-41/+644
Add Ayu theme to rustdoc This is a port of a theme I maintain (https://github.com/Cldfire/ayu-rs) to the native rustdoc theme system. [Ayu](https://github.com/dempfi/ayu) (dark) is a richly-colored dark theme that many people enjoy using across a wide variety of environments. Corresponds to the Ayu theme in [mdBook](https://github.com/rust-lang/mdBook). Some screenshots: ![image](https://user-images.githubusercontent.com/13814214/79547087-6c935780-8061-11ea-8a33-38e9472e9fec.png) ![image](https://user-images.githubusercontent.com/13814214/79547150-8339ae80-8061-11ea-97be-9e13a8b275d7.png) ![image](https://user-images.githubusercontent.com/13814214/79547221-98164200-8061-11ea-9649-9b11ccbb33e3.png) ![image](https://user-images.githubusercontent.com/13814214/79547310-b419e380-8061-11ea-9965-d4f90b2280ab.png) ![image](https://user-images.githubusercontent.com/13814214/79547443-e7f50900-8061-11ea-8872-06d74010691e.png) Note that this pull request also makes some small code changes to allow for disabling theme stylesheets, preventing the rules from all the different themes from conflicting with one another. The only stylesheet that is not disabled is `light.css`; the theming system (quite hackily) switches themes by changing the href on this stylesheet and so permanently disabling all the others works perfectly fine.
2020-07-14Focus on the current file in the source file sidebarGuillaume Gomez-0/+5
2020-07-12Add Ayu theme to rustdocJarek Samic-0/+571
2020-07-12Clean up handling of style files in rustdocJarek Samic-41/+73
Disable all themes other than `light.css` to prevent rule conflicts
2020-07-11rustdoc: insert newlines between attributesAndy Russell-8/+13
2020-07-10Add margin after doc search resultsGuillaume Gomez-0/+1
2020-07-10Avoid "whitelist"Tamir Duberstein-2/+2
Other terms are more inclusive and precise.
2020-07-09Add option to collapse automatically implementorsGuillaume Gomez-3/+10
2020-07-09Rollup merge of #74107 - nbdd0121:rustdoc, r=GuillaumeGomezManish Goregaokar-1/+7
Hide `&mut self` methods from Deref in sidebar if there are no `DerefMut` impl for the type. This partially addresses #74083.
2020-07-09Auto merge of #74131 - ollie27:rustdoc_invalid_codeblock_attributes_name, ↵bors-1/+1
r=GuillaumeGomez rustdoc: Rename invalid_codeblock_attribute lint to be plural Lint names should be plural as per the lint naming conventions: https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints r? @GuillaumeGomez
2020-07-07rustdoc: Rename invalid_codeblock_attribute lint to be pluralOliver Middleton-1/+1
2020-07-06Rollup merge of #74067 - rye:rustdoc-fqn-hover-underline, r=GuillaumeGomezManish Goregaokar-0/+3
rustdoc: Restore underline text decoration on hover for FQN in header This causes the components of FQN's (e.g. `std`, `net`, and `Ipv4Addr` of the FQN `std::net::Ipv4Addr`) to behave similarly to other links in the contents of rustdoc-styled pages. When the user hovers over them, more clearly indicating that they can be used for navigation. I (and I hope others at least in part) have found the prior design to be somewhat confusing, as it is not clear (upon hovering) that the various parts of the FQN are actually links that the user can navigate to. <details><summary>📸 Before, mouse hovered over "net" in the FQN</summary> <img alt="A rustdoc page with the mouse hovered over the fully-qualified name in the page header, producing no visual change" src="https://user-images.githubusercontent.com/1566689/86538363-4c827000-bebb-11ea-8291-5ea6b85d7e19.png" /> </details> <details><summary>📸 After, mouse hovered over "net" in the FQN</summary> <img alt="A rustdoc page with the mouse hovered over the fully-qualified name in the page header, now with an underline showing up under the word hovered over by the mouse" src="https://user-images.githubusercontent.com/1566689/86538471-d3374d00-bebb-11ea-9bb3-7aa2d7a4800b.png" /> </details>
2020-07-06Hide `&mut self` methods from Deref in sidebarGary Guo-1/+7
If there are no `DerefMut` impl for the type.
2020-07-05rustdoc: Restore underline text decoration on hover for FQN in headerKristofer Rye-0/+3
This causes the components of FQN's to behave similarly to other links in the contents of rustdoc-styled pages. I (and I hope others at least in part) have found the prior design to be somewhat confusing, as it is not clear (upon hovering) that the various parts of the FQN are actually links that the user can navigate to. In short, this patch makes links in the FQN have an underline when the user hovers over them, more clearly indicating that they can be used for navigation. Signed-off-by: Kristofer Rye <kristofer.rye@gmail.com>
2020-07-02Remove render-redirect-pages option in rustdocGuillaume Gomez-49/+0
2020-07-02Simplify DOM by removing IDs for code tagsGuillaume Gomez-52/+16
2020-07-02Expand sub code blocks block content when hidden when the page hash refers to itGuillaume Gomez-0/+8
2020-07-02Improve page hash handlingGuillaume Gomez-5/+7
2020-07-02No need to call getPageId a second timeGuillaume Gomez-1/+1
2020-06-26Rollup merge of #72771 - jyn514:rustdoc, r=ManishearthManish Goregaokar-2/+9
Warn if linking to a private item Closes https://github.com/rust-lang/rust/issues/72769 r? @GuillaumeGomez
2020-06-26Generate docs for links to private items when passed --document-privateJoshua Nelson-2/+9
- Pass around document_private a lot more - Add tests + Add tests for intra-doc links to private items + Add ignored tests for warnings in reference links
2020-06-26Rollup merge of #72967 - integer32llc:prevent-default-arrows, r=kinnisonManish Goregaokar-0/+2
Don't move cursor in search box when using arrows to navigate results ## What happens - Go to https://doc.rust-lang.org/stable/std/index.html - Press 's' to focus the search box - Type a query like 'test' - Press the down arrow one or more times to change which search result is highlighted - Press the up arrow once to go up one search result - Notice the cursor in the search box is now at the beginning of your query, such that if you now typed 'a' the search box would contain 'atest', when it would be expected that the cursor would have remained where it was and if you typed 'a' at this point it would result in 'testa' - Press the down arrow once to go down one search result - Now notice the cursor is at the end of your query again ## What I expected I expected that changing which search result was highlighted using the up and down arrows would have no effect on where the cursor was in the search box. ## The fix This PR prevents the default action of the up and down arrows when the custom keydown events are happening during a search.
2020-06-23rustdoc: Fix doc aliases with crate filteringOliver Middleton-6/+7
Fix a crash when searching for an alias contained in the currently selected filter crate. Also remove alias search results for crates that should be filtered out. The test suite needed to be fixed to actually take into account the crate filtering and check that there are no results when none are expected.
2020-06-18Rollup merge of #73476 - JakobDegen:should_panic_rustdoc, r=GuillaumeGomezManish Goregaokar-1/+41
Added tooltip for should_panic code examples This change adds a tooltip to the documentation for `should_panic` examples. It currently displays identically to `compile_fail` examples, save for the changed text. It may be helpful to change the color that this displays in to make it visually more clear what is going on, but I'm unsure if additional colors wouldn't just be distracting. I brought this [up on internals](https://internals.rust-lang.org/t/indicating-that-an-example-is-should-panic-in-docs/12544) a few days ago, and there seemed to be a mild positive response to it.
2020-06-18Rollup merge of #72968 - integer32llc:docs-arrow-keys, r=GuillaumeGomezManish Goregaokar-13/+24
Only highlight doc search results via mouseover if mouse has moved ## What happens - Go to https://doc.rust-lang.org/stable/std/index.html - Put your mouse cursor somewhere in the middle where search results will appear and then don't move the mouse - Press 's' to focus the search box - Type a query that brings up enough search results to go under where your mouse cursor is - Press the down arrow - The search result that is one below where your mouse cursor is will be highlighted. ## What I expected When not currently using the mouse, I expect doing a search and then pressing the down arrow to always highlight the first search result immediately below the search box. ## The fix This feels a bit hacky to me; I'm open to other solutions. This introduces a global JS var that keeps track of whether the person searching has moved their mouse after doing a search or not, and only uses the mouse position to highlight search results if the person HAS moved the mouse AFTER doing a search.
2020-06-18Added tooltip for should_panic code examples.Jake Degen-1/+41
Previously, compile_fail and ignore code examples displayed a tooltip indicating this in the documentation. This tooltip has now also been added to should_panic examples.
2020-06-15Re-order correctly the sections in the sidebarGuillaume Gomez-2/+2
2020-06-09Fix more clippy warningsMatthias Krüger-1/+1
Fixes more of: clippy::unused_unit clippy::op_ref clippy::useless_format clippy::needless_return clippy::useless_conversion clippy::bind_instead_of_map clippy::into_iter_on_ref clippy::redundant_clone clippy::nonminimal_bool clippy::redundant_closure clippy::option_as_ref_deref clippy::len_zero clippy::iter_cloned_collect clippy::filter_next
2020-06-08Rollup merge of #71842 - tspiteri:doc-impl-const, r=GuillaumeGomezDylan DPC-1/+3
doc: make impl block collapsible if it has an associated constant Fixes #71822.
2020-06-03Only highlight results via mouseover if mouse has movedCarol (Nichols || Goulding)-13/+24
2020-06-03Don't move cursor in search box when using arrows to navigate search resultsCarol (Nichols || Goulding)-0/+2
2020-05-31Auto merge of #72831 - Dylan-DPC:rollup-6rxjwt9, r=Dylan-DPCbors-4/+12
Rollup of 5 pull requests Successful merges: - #72691 (Fix escape key handling) - #72807 (Avoid setting wrong obligation cause span of associated type mismatch) - #72812 (Miri tests: skip parts of test_char_range) - #72829 (Clarify terms in doc comments) - #72830 (Fix release notes for niche initialization change) Failed merges: r? @ghost
2020-05-31Rollup merge of #72691 - GuillaumeGomez:escape-key-handling, r=kinnisonDylan DPC-4/+12
Fix escape key handling Fixes #72647. The problem was that you could have a timeout just after the moment you press "escape", putting back the results. r? @kinnison
2020-05-31Auto merge of #72767 - pnkfelix:track-devirtualized-filenames-issue-70924, ↵bors-5/+6
r=eddyb Track devirtualized filenames Split payload of FileName::Real to track both real and virtualized paths. (Such splits arise from metadata refs into libstd; the virtualized paths look like `/rustc/1.45.0/src/libstd/io/cursor.rs` rather than `/Users/felixklock/Dev/Mozilla/rust.git/src/libstd/io/cursor.rs`) This way, we can emit the virtual name into things like the like the StableSourceFileId (as was done back before PR #70642) that ends up in incremental build artifacts, while still using the devirtualized file path when we want to access the file. Fix #70924
2020-05-31Put input timeout clearance inside a functionGuillaume Gomez-13/+11
2020-05-30Rollup merge of #72650 - GuillaumeGomez:sort-sidebar-elements, r=kinnisonRalf Jung-32/+31
Sort sidebar elements r? @kinnison
2020-05-29Split payload of FileName::Real to track both real and virutalized paths.Felix S. Klock II-5/+6
Such splits arise from metadata refs into libstd. This way, we can (in a follow on commit) continue to emit the virtual name into things like the like the StableSourceFileId that ends up in incremetnal build artifacts, while still using the devirtualized file path when we want to access the file. Note that this commit is intended to be a refactoring; the actual fix to the bug in question is in a follow-on commit.
2020-05-28Fix escape key handlingGuillaume Gomez-3/+13
2020-05-27Sort fields, variants and other unsorted elements in the sidebarGuillaume Gomez-32/+31
2020-05-27doc: make impl block collapsible if it has an associated constantTrevor Spiteri-1/+3
Fixes #71822.
2020-05-27Rollup merge of #72610 - GuillaumeGomez:revert-unwanted-css-changes, r=Dylan-DPCDylan DPC-9/+0
Remove font-display settings Since for the moment, the result isn't as expected since #72092 when not using docs locally, let's revert them. r? @Dylan-DPC
2020-05-26Rollup merge of #72294 - GuillaumeGomez:js-cleanup, r=kinnisonDylan DPC-298/+304
JS cleanup The goal here is just to improve the source code a bit. I recommend to review one commit at a time, otherwise it might not make much sense. :) The biggest commit is the second one: to prevent to have "global" variables declared in `main.js` (and thus prevent name conflict or overwriting), I moved such code into anonymous functions. r? @kinnison cc @rust-lang/rustdoc
2020-05-26Improve formattingGuillaume Gomez-2/+2
2020-05-26Remove font-display settingsGuillaume Gomez-9/+0
2020-05-26Auto merge of #71900 - GuillaumeGomez:clean-up-rustdoc, r=ollie27,kinnisonbors-7/+10
Clean up rustdoc source code Fixes #70498. r? @kinnison cc @rust-lang/rustdoc
2020-05-26Fix eslint lintsGuillaume Gomez-34/+34
2020-05-26Reexported functions are now declared directly as "windows" fieldGuillaume Gomez-11/+6
2020-05-26Move "global" code into anonymous functionsGuillaume Gomez-248/+258
2020-05-26Move focusSearchBar and defocusSearchBar functions to the top of the file ↵Guillaume Gomez-10/+11
with other functions