Skip to content

Make the rustdoc example links more noticable #28963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2015
Merged

Conversation

mdinger
Copy link
Contributor

@mdinger mdinger commented Oct 11, 2015

This is to make the link more prominent so hopefully people will actually see it. The new icon is partially because I wasn't sure how easy it would be to apply the previous transformations only to the last character of the string. As it is, I wasn't sure at first but I think the look is growing on me.

A minor nitpick is that the space after Runnable is underlined and I tried to fix that but it wasn't working for me right now. I tried switching a link with subelements to a div with subelements but I missed something because it wasn't working correctly.


Unselected:

arrow


Selected:

arrow_selected

Fixes #28958

@rust-highfive
Copy link
Contributor

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@@ -48,6 +48,7 @@ r##"<!DOCTYPE html>
<title>{title}</title>

<link rel="stylesheet" type="text/css" href="{root_path}main.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need to include the whole font-awesome package for one small rocket icon. This won't work for offline documentation, too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I thought people might say that. Just the text?

@killercup
Copy link
Member

Good initiative.

But, wow, that button is massive! Also in the wrong place, IMHO. I'd just add a line below the code sample that reads "Run this code on play.rust-lang.org now »". (People tend to read code from top to bottom, so they'll probably notice this more than something on the top right corner.)

@jonas-schievink
Copy link
Contributor

Hmm, I might be missing something, but why not make the old icon always visible (and may be have a tooltip reading "run on playpen")?

@alilleybrinker
Copy link
Contributor

@jonas-schievink I think the idea is to make it more noticeable than that would. Although I agree with @killercup that the current button design is too large.

@Wilfred
Copy link
Contributor

Wilfred commented Oct 11, 2015

Great idea!

I think the button should have a verb on it. 'Run' or 'Run in playpen' would clarify that this is an action a user can take, not just a status lozenge.

@mdinger
Copy link
Contributor Author

mdinger commented Oct 11, 2015

rustbyexample.com uses run and reset to reset and run the example in place. This doesn't do that so the wording is different to distinguish the different behaviour.

@mdinger
Copy link
Contributor Author

mdinger commented Oct 11, 2015

The problem with just the icon is it's bounding box is tall and doesn't allow the icon to scale any larger. Originally I tried to make this bigger but the icon height really doesn't allow any size increase. You can add padding to make it square but I thought the icon needed to be bigger if people are supposed to notice it easier. That led to me trying text with a different icon.

icon

@mdinger
Copy link
Contributor Author

mdinger commented Oct 11, 2015

@killercup The button is in the same place as before. Just shifted down a few pixels I think and it still only shows on mouseover.

@killercup
Copy link
Member

in the same place as before

only shows on mouseover

Yes, and these are both things I would change, @mdinger. 😃

@mdinger
Copy link
Contributor Author

mdinger commented Oct 11, 2015

Hmm...I don't know. On this page there are 5 small examples immediately in front of you. Adding a playpen link to each would double the vertical size of some of the examples and at least make all of them taller. I like that it's tucked somewhat inconspicuously but I can see your suggestion as making it more visible too...

@mdinger
Copy link
Contributor Author

mdinger commented Oct 11, 2015

Here's a quick mockup of what I interpret @killercup's suggestion as. I darkened the code for easier contrast comparison.

mockup

@mdinger
Copy link
Contributor Author

mdinger commented Oct 11, 2015

Updated the PR without the rocket while these other things are discussed. Here's a picture of it.


runnable

@mdinger
Copy link
Contributor Author

mdinger commented Oct 11, 2015

I could also switch the word around but the word has to be small (Playpen maybe) since everyone already things the icon is too big as it is. FWIW, the icon with the rocket looks better than without. ha

@mdinger
Copy link
Contributor Author

mdinger commented Oct 13, 2015

Is this better? Worse? The colors are a straight inverse of the original arrow. If it's too noticeable, I could make it a grey slightly darker than the background. That would be it a little more subtle.

@steveklabnik
Copy link
Member

@mdinger which 'this' are you talking about?

@iliekturtles
Copy link
Contributor

What about the style from https://www.rust-lang.org/?

image

The current rustdoc style doesn't even work at all for me (Windows 7 / Chrome stable):

image

@mdinger
Copy link
Contributor Author

mdinger commented Oct 13, 2015

@steveklabnik I'm asking about the most recent picture I included which is what the current PR implements (this).

@iliekturtles rust-lang.org runs the example in place whereas rustdoc just links the example to the playpen. Should the icons be the same regardless? About the icon missing, does changing the browser encoding fix it?

I could make changes but I need input on how it needs to be changed to be accepted. If I just need to change the word, add an icon, or change the background, those are all easy. If I have to implement something more like @killercup suggested, that is much more involved.

@iliekturtles
Copy link
Contributor

@mdinger I like "Run" or "Run" + an icon. If you do include text it should be a verb.

Not sure what you mean / how to change the encoding. Changing the font list with Chrome's dev tools just changes to a different invalid character. Copying the character to notepad or this edit box gives an arrow pointing up and to the left (preview shows an invalid character): ⇱. IE and Edge (on Win 10) both properly show an up-right arrow.

@mdinger
Copy link
Contributor Author

mdinger commented Oct 14, 2015

@iliekturtles Try switching it to unicode or something else like this:

encoding

Okay. I dislike Run because it doesn't actually run. It takes you somewhere it can be run but maybe I'm in the minority on this.

Yeah, that's the icon. The browser just mirrors it for looks.

@alexcrichton
Copy link
Member

r? @steveklabnik

@steveklabnik
Copy link
Member

So, I am very interested in improving this. However, the encoding situation makes me a bit worried about the current implementation, this isn't something we should have to worry about.

I think that just "Run" probably suffices. Probably.

@iliekturtles
Copy link
Contributor

@mdinger UTF-8 was already properly detected. Attempting different encodings didn't help. Every Windows 7/10 machine with Chrome I've checked has been affected.

@mdinger
Copy link
Contributor Author

mdinger commented Oct 14, 2015

Updated. Here is the updated picture.

run


Fixing the encoding is outside the scope of this issue but removing non-ASCII characters should fix the situation in the meantime.

@mdinger
Copy link
Contributor Author

mdinger commented Oct 14, 2015

r?

1 similar comment
@mdinger
Copy link
Contributor Author

mdinger commented Oct 21, 2015

r?

@steveklabnik
Copy link
Member

@bors: r+

@bors
Copy link
Collaborator

bors commented Oct 21, 2015

📌 Commit dd342b0 has been approved by steveklabnik

@steveklabnik
Copy link
Member

@mdinger sorry about that, I've been to two conferences in two countries in the last seven days, and I wanted to sit on it a bit before merging. Thanks for your patience.

@mdinger
Copy link
Contributor Author

mdinger commented Oct 21, 2015

It's okay. I actually tried to get it fixed the day it came up in a reddit thread so the guy who just saw the issue would think Rust devs fix issues fast but that didn't happen.

bors added a commit that referenced this pull request Oct 21, 2015
This is to make the link more prominent so hopefully people will actually see it. The new icon is partially because I wasn't sure how easy it would be to apply the previous transformations only to the last character of the string. As it is, I wasn't sure at first but I think the look is growing on me.

A minor nitpick is that the space after `Runnable` is underlined and I tried to fix that but it wasn't working for me right now. I tried switching a link with subelements to a div with subelements but I missed something because it wasn't working correctly.

---
Unselected:

![arrow](https://cloud.githubusercontent.com/assets/4156987/10414475/b1730ab2-6fa4-11e5-9062-15bc0c7c8b96.png)

---

Selected:

![arrow_selected](https://cloud.githubusercontent.com/assets/4156987/10414483/4a78088e-6fa5-11e5-864e-c83f354769b1.png)

Fixes #28958
@bors
Copy link
Collaborator

bors commented Oct 21, 2015

⌛ Testing commit dd342b0 with merge 37ef506...

@bors
Copy link
Collaborator

bors commented Oct 21, 2015

💔 Test failed - auto-linux-64-x-android-t

@alexcrichton
Copy link
Member

@bors: retry

On Wed, Oct 21, 2015 at 2:19 PM, bors notifications@github.com wrote:

[image: 💔] Test failed - auto-linux-64-x-android-t
http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/6788


Reply to this email directly or view it on GitHub
#28963 (comment).

@alexcrichton
Copy link
Member

@bors: retry force

@bors
Copy link
Collaborator

bors commented Oct 22, 2015

⌛ Testing commit dd342b0 with merge 5692e16...

bors added a commit that referenced this pull request Oct 22, 2015
This is to make the link more prominent so hopefully people will actually see it. The new icon is partially because I wasn't sure how easy it would be to apply the previous transformations only to the last character of the string. As it is, I wasn't sure at first but I think the look is growing on me.

A minor nitpick is that the space after `Runnable` is underlined and I tried to fix that but it wasn't working for me right now. I tried switching a link with subelements to a div with subelements but I missed something because it wasn't working correctly.

---
Unselected:

![arrow](https://cloud.githubusercontent.com/assets/4156987/10414475/b1730ab2-6fa4-11e5-9062-15bc0c7c8b96.png)

---

Selected:

![arrow_selected](https://cloud.githubusercontent.com/assets/4156987/10414483/4a78088e-6fa5-11e5-864e-c83f354769b1.png)

Fixes #28958
@bors bors merged commit dd342b0 into rust-lang:master Oct 22, 2015
bors added a commit that referenced this pull request Oct 26, 2015
Makes rustbook code playpen links follow the style set in #28963. This is basically cut and paste from the other one. The link looks better and still works so I assume it's good.

![rustbook](https://cloud.githubusercontent.com/assets/4156987/10717631/7a74f8ae-7b34-11e5-8870-35b5fc2526a4.png)

Fixes #29308

r? @steveklabnik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the mouseover clickable link for rustdoc code more visible
10 participants