Skip to content
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

Highlight deprecated API components in "Table of Contents" #772

Closed
ilfroloff opened this issue Jun 2, 2016 · 14 comments
Closed

Highlight deprecated API components in "Table of Contents" #772

ilfroloff opened this issue Jun 2, 2016 · 14 comments

Comments

@ilfroloff
Copy link

ilfroloff commented Jun 2, 2016

Hello All!

I have a proposal of how to increase understanding on which of properties/methods in module API are deprecated. When someone opens module's API page, he/she sees "Table of Contents" and it's not clear which part is deprecated (especially in util module).

My vision of deprecated parts in "Table of Contents":
Change the color

CSS for list item:

li.deprecated,
li.deprecated a {
    color: #D60027; // same as backgroud-color of Deprecated box
}

Thanks!

@fhemberger fhemberger added the docs label Jun 2, 2016
@MylesBorins
Copy link
Contributor

I really like this idea

/cc @nodejs/documentation

@ilfroloff I think you will want to send a PR against the main repo to this file https://github.com/nodejs/node/blob/master/doc/api_assets/style.css

@lpinca
Copy link
Member

lpinca commented Jun 3, 2016

👍

@ghost
Copy link

ghost commented Jun 3, 2016

sounds good, yeah!

@benjamingr
Copy link
Member

I think graying it out rather than making it red would be better since red catches the eye.

@Knighton910
Copy link
Contributor

LGTM
+1 GRAY

@steebchen
Copy link

What about striking through deprecated lines: deprecated
Or striking through while colored grey?

li.deprecated,
li.deprecated a {
    color: #ccc;
    text-decoration: line-through;
}

@evanlucas
Copy link
Contributor

I think I would like gray. It would be awesome to see some prototypes though

@benjamingr
Copy link
Member

@evanlucas sure, run this in the chrome devtools at the production docs and it will strikethrough and change the color of all deprecated APIs.

var links = Array.from(document.querySelectorAll("#toc li a"))
for(const method of links) { // very hacky
  const marker = document.querySelector(method.getAttribute("href"));
  if(!marker) continue;
  const heading = marker.parentNode.parentNode;
  let stability = heading.nextElementSibling;
  if(stability.className === "api_metadata") stability = stability.nextElementSibling; 
  if(stability.className.includes("api_stability_0")) {
     method.style.color = "#999";
     method.style.textDecoration = "line-through";
  }
}

@evanlucas
Copy link
Contributor

thanks @benjamingr. So the link becomes a lot less readable on hover would be my only complaint with that. I'm sure we could fix that quite easily though. I think the best think to do here would be to have a pr with one of these on nodejs/node and we can go from there?

@addaleax
Copy link
Member

addaleax commented Jun 5, 2016

As much as I would find gray more intuitive, too, I’d be worried that the low contrast from graying out entries might not work out as well as striking through for people with visual impairments. But then again I’m also definitely not an expert on that topic.

@Knighton910
Copy link
Contributor

Knighton910 commented Jun 5, 2016

I was thinking about a dark blue, but at the same time i don't want the docs to look like a rainbow. no offense to rainbows. But something of grey or dark grey or even vanilla white should be fine, i guess.

@benjamingr
Copy link
Member

benjamingr commented Jun 5, 2016

@addaleax that's a good point, #999999 doesn't meat the contrast accessibility standard, we should go with something more like #555555.

@RafaelKr
Copy link

RafaelKr commented Jun 6, 2016

As much as I would find gray more intuitive, too, I’d be worried that the low contrast from graying out entries might not work out as well as striking through for people with visual impairments. But then again I’m also definitely not an expert on that topic.

You could make deprecated items grey and add a toogle-button at the top to also strike them through (Or don't show them at all, when button is toggled).

@ilfroloff
Copy link
Author

@ilfroloff I think you will want to send a PR against the main repo to this file https://github.com/nodejs/node/blob/master/doc/api_assets/style.css

Created PR nodejs/node#7189

jasnell pushed a commit to nodejs/node that referenced this issue Oct 14, 2016
Highlight deprecated API methods/properties in "Table of Contents" for
increasing understandability. Adapted code to eslint standards.

PR-URL: #7189
Fixes: nodejs/nodejs.org#772
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit to nodejs/node that referenced this issue Nov 11, 2016
Highlight deprecated API methods/properties in "Table of Contents" for
increasing understandability. Adapted code to eslint standards.

PR-URL: #7189
Fixes: nodejs/nodejs.org#772
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit to nodejs/node that referenced this issue Nov 11, 2016
Highlight deprecated API methods/properties in "Table of Contents" for
increasing understandability. Adapted code to eslint standards.

PR-URL: #7189
Fixes: nodejs/nodejs.org#772
Reviewed-By: Jeremiah Senkpiel <[email protected]>
Reviewed-By: Roman Reiss <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
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

No branches or pull requests

10 participants