1
Fork 0
Commit graph

441 commits

Author SHA1 Message Date
Guillaume Gomez
bfe49a0aa3
Rollup merge of #79796 - GuillaumeGomez:hide-associated-const-when-collapsing, r=jyn514
Hide associated constants too when collapsing implementation

Fixes #71849.

r? `@jyn514`
2020-12-15 16:43:21 +01:00
Guillaume Gomez
2363a20b98 Make search results tab and help button focusable with keyboard 2020-12-10 11:38:12 +01:00
Tyler Mandry
f74f3b2f37
Rollup merge of #79862 - GuillaumeGomez:tab-lock, r=Manishearth
Remove tab-lock and replace it with ctrl+up/down arrows to switch between search result tabs

Fixes https://github.com/rust-lang/rust/issues/65212

What took the longest time was to update the help popup in the end.

r? `@Manishearth`
2020-12-09 13:38:38 -08:00
Guillaume Gomez
570de0a3be Remove tab-lock and replace it with ctrl+up/down arrows to switch between search result tabs 2020-12-09 20:47:55 +01:00
Guillaume Gomez
99df3406cf Hide associated constants too when collapsing implementation 2020-12-09 14:13:56 +01:00
Camelid
e178030ea4 Use createElement and innerHTML instead of DOMParser
@GuillaumeGomez was concerned about browser compatibility.
2020-12-03 14:11:37 -08:00
Camelid
5d4a7128d9 Render Markdown in search results
Previously Markdown documentation was not rendered to HTML for search results,
which led to the output not being very readable, particularly for inline code.
This PR fixes that by rendering Markdown to HTML with the help of pulldown-cmark
(the library rustdoc uses to parse Markdown for the main text of documentation).
However, the text for the title attribute (the text shown when you hover over an
element) still uses the plain-text rendering since it is displayed in browsers
as plain-text.

Only these styles will be rendered; everything else is stripped away:

* *italics*
* **bold**
* `inline code`
2020-12-03 14:11:37 -08:00
bors
0fa9d31c41 Auto merge of #78876 - GuillaumeGomez:better-setting-keyboard-ux, r=jyn514
Make keyboard interactions in the settings menu more pleasant

#78868 improved the keyboard interactions with the settings page. This PR goes a bit further by allowing more than just "space" to toggle the checkboxes.

r? `@jyn514`
2020-12-01 09:58:59 +00:00
Guillaume Gomez
caf6c5790a Rename "stability" CSS class to "item-info" 2020-11-24 18:07:03 +01:00
Guillaume Gomez
28a94a3ae5 Prevent feature information to be hidden if it's on the impl directly 2020-11-22 16:10:16 +01:00
Wim Looman
c34350ab4f
Add tests and improve rendering of features on traits 2020-11-14 22:11:45 +01:00
Guillaume Gomez
14ecee7693 Improve comment for getVirtualKey function 2020-11-12 15:00:42 +01:00
Guillaume Gomez
704050da23 Make keyboard interactions in the settings menu more pleasant 2020-11-12 15:00:42 +01:00
bors
7f5a42b073 Auto merge of #78976 - GuillaumeGomez:rollup-endkih3, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #78916 (extend const generics test suite)
 - #78921 (Improve the page title switch handling between search and doc)
 - #78933 (Don't print thread ids and names in `tracing` logs)
 - #78960 (Test default values for const parameters.)
 - #78971 (Update books)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2020-11-12 13:10:07 +00:00
Guillaume Gomez
46c921d3ab Improve the page title switch handling between search and doc 2020-11-10 15:01:01 +01:00
Guillaume Gomez
8b20e9b478 Add shortcut for theme picker menu 2020-11-05 15:37:33 +01:00
Michael Howell
17b8ca952b Pull theme picker keyboard code into main.js
Most of the code in mod.rs should be code that really needs to have
the list of available themes inlined into it.
2020-10-30 14:31:04 -07:00
Michael Howell
300362e0e4 Close the theme picker when Escape is pressed 2020-10-30 13:03:01 -07:00
Ian Jackson
2e10475fdd rustdoc: js: Use getSettingValue for all rustdoc-* values
Currently, storage.js and main.js have many open-coded calls to
getCurrentValue for "rustdoc-" values, but these are settings and
should be handled by getSettingValue.

So make getSettingValue part of storage.js (where everyone can call
it) and use it everywhere.

No functional change yet.  We are going to make getSettingValue do
something more sophisticated in a moment.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
2020-10-28 15:44:59 +00:00
Guillaume Gomez
880d644a50 Add link to rustdoc book in rustdoc help popup 2020-10-19 15:25:33 +02:00
Guillaume Gomez
a577942a8f Fix sidebar scroll on mobile devices 2020-10-16 15:01:17 +02:00
Aleksey Kladov
300d7f661a
Rollup merge of #76052 - aszenz:GH-66816_removes_disable_attribute_before_return, r=GuillaumeGomez
GH-66816:  Remove disable attr before return

Passing --disable-per-crate-search removes the create search inputs so moved code around so that the search input is enabled
first before the function returns.

Fixes #66816
2020-08-31 12:51:46 +02:00
Dylan DPC
b1f983a582
Rollup merge of #76022 - GuillaumeGomez:cleanup-rustdoc-front, r=jyn514
Clean up rustdoc front-end source code

r? @jyn514
2020-08-30 01:43:57 +02:00
Guillaume Gomez
3a4ef0f57d Use an id instead of a function 2020-08-29 12:38:50 +02:00
asrar
eb2bb99021 GH-66816: Process before enabling search 2020-08-29 10:19:58 +00:00
asrar
7ee515579e GH-66816: Removes disable before return
Passing --disable-per-crate-search removes the create search
inputs so moved code around so that the search input is enabled
first before the function returns
2020-08-29 09:33:41 +00:00
Guillaume Gomez
4b8ebbcc5a Clean up rustdoc front-end source code 2020-08-28 13:30:21 +02:00
bors
397b390cc7 Auto merge of #75976 - GuillaumeGomez:help-popup, r=jyn514
Improve help popup

Fixes #75623.

The second commit is just a slight improvement: the help popup won't be created until someone presses "?" or ESC. Not a big improvement in itself but considering the low amount of code required, I think it was worth the shot.

r? @jyn514
2020-08-27 21:30:32 +00:00
Guillaume Gomez
86e42c2742 Delay help popup creation to when it's needed 2020-08-27 14:22:54 +02:00
Guillaume Gomez
1727c7a194 Improve helper wording 2020-08-27 14:22:54 +02:00
Guillaume Gomez
76bd5b3852 Add explanations on the results search element check 2020-08-24 12:59:16 +02:00
Guillaume Gomez
6cb364cda4 Prevent automatic page change when using history 2020-08-23 14:39:43 +02:00
Guillaume Gomez
fdf2fe18a1 Fully handle "?" shortcut 2020-08-11 18:28:01 +02:00
Dylan DPC
51ed33d8c2
Rollup merge of #75366 - GuillaumeGomez:help-button, r=jyn514
Add help button

Part of #75197.

Here is a screenshot of the result:

![Screenshot from 2020-08-10 16-53-20](https://user-images.githubusercontent.com/3050060/89796547-14112a00-db2a-11ea-9f25-57b30ab68f9b.png)

r? @jyn514
2020-08-11 01:56:43 +02:00
Guillaume Gomez
a34bc7961a Add help button 2020-08-10 16:52:19 +02:00
Camelid
f3cc957f2e Rename "Important traits" to "Notable traits"
* Rename it in the UI
* Rename the CSS classes
2020-08-09 12:09:05 -07:00
Manish Goregaokar
ae6c7e6f40 Review comments for JS 2020-07-16 09:58:37 -07:00
Manish Goregaokar
734afb4830 Make spotlight show on hover
This makes the spotlight show on hover instead of click. Clicks can be
used to persist it, which is also what's used on mobile.
2020-07-16 09:58:37 -07:00
Manish Goregaokar
98450757e5 Revert "Remove "important traits" feature"
This reverts commit 1244ced958.
2020-07-16 09:58:17 -07:00
Manish Goregaokar
efad203144
Rollup merge of #74196 - GuillaumeGomez:auto-collapse-implementors, r=Manishearth
Add option to collapse automatically implementors

Fixes #73403

It adds an option (enabled by default) which collapses all implementors impl blocks.

r? @kinnison
cc @rust-lang/rustdoc
2020-07-15 11:01:16 -07:00
Guillaume Gomez
970174a1e5 Add option to collapse automatically implementors 2020-07-09 21:42:02 +02:00
Guillaume Gomez
cdabdfa104 Simplify DOM by removing IDs for code tags 2020-07-02 13:19:04 +02:00
Guillaume Gomez
fc61cca41c Expand sub code blocks block content when hidden when the page hash refers to it 2020-07-02 13:19:04 +02:00
Guillaume Gomez
0fcb7dabac Improve page hash handling 2020-07-02 13:19:04 +02:00
Guillaume Gomez
d5141e6829 No need to call getPageId a second time 2020-07-02 13:19:04 +02:00
Manish Goregaokar
a25fbb9710
Rollup merge of #72967 - integer32llc:prevent-default-arrows, r=kinnison
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-26 00:38:58 -07:00
Oliver Middleton
478750c1db rustdoc: Fix doc aliases with crate filtering
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-23 09:27:37 +01:00
Manish Goregaokar
bf59152c01
Rollup merge of #72968 - integer32llc:docs-arrow-keys, r=GuillaumeGomez
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-18 15:20:49 -07:00
Dylan DPC
98bd22bda3
Rollup merge of #71842 - tspiteri:doc-impl-const, r=GuillaumeGomez
doc: make impl block collapsible if it has an associated constant

Fixes #71822.
2020-06-08 22:15:08 +02:00
Carol (Nichols || Goulding)
1bc4e45b3f
Only highlight results via mouseover if mouse has moved 2020-06-03 21:18:39 -04:00