doc: Highlight deprecated API components in "Table of Contents"#7189
doc: Highlight deprecated API components in "Table of Contents"#7189ilfroloff wants to merge 1 commit intonodejs:masterfrom ilfroloff:docs-deprecated-highlight
Conversation
|
cc @nodejs/documentation @nodejs/website |
tools/doc/html.js
Outdated
There was a problem hiding this comment.
Is this really the cleanest way to do this? Looks super hacky.
There was a problem hiding this comment.
Yep, it's one of the cleanest solutions in this situation. I got regular expression from parseAPIHeader method which used below in code.
Code: https://github.com/nodejs/node/blob/master/tools/doc/html.js#L265
Note about (index - 1 === headingIndex || index - 2 === headingIndex):
I didn't find better solution for this moment.
It's small hack for detection place for marking stability in heading block using tok.type === 'code'.
Could you please set |
|
Seems to work. I like it. I was a bit conflicted at first about the strike through but I think that may be good for colorblind users. cc @nodejs/documentation |
tools/doc/html.js
Outdated
|
@ilfroloff I'll be willing to review more if you could change less where not necessary. :) |
|
Also if you could run |
|
Thanks for answer. |
|
@Fishrock123 I removed unnecessary changes and resolved error from |
tools/doc/html.js
Outdated
There was a problem hiding this comment.
can probably be a top-level variable, that way we don't need to pass it to parseAPIHeader
|
LGTM minus comments |
|
ping @ilfroloff |
|
@Fishrock123 pong) |
|
@Fishrock123 completed. I implemented your suggestions |
tools/doc/html.js
Outdated
There was a problem hiding this comment.
@ilfroloff Would this be better as
var toc_entry = tok.stability ? `<li class="${tok.stability}">` : '<li>';
toc_entry += `<a href="#' + id + '">${tok.text}</a>`;
toc.push(new Array((depth - 1) * 2 + 1).join(' ') + toc_entry);That would get rid of the massive find/replace after the fact?
There was a problem hiding this comment.
@Fishrock123 sorry, but this code cannot be implemented, because <li> html tag generated by this code.
Line 334
+ '* %stability_' + tok.stability + '%' +need because I want to add class attribute for <li> after parsing.
Also, <li> don't need to be closed, because </li> tag generates by markdown parser.
|
@ilfroloff It doesn't look like the |
|
ping @ilfroloff |
|
@ilfroloff just tried to rebase and it didn't seem to work... If you have time could rebase? Also, I still don't understand why my find/replace comment wouldn't work.. :( If you don;t, mind if I take this PR over and make a new one (preserving your authorship)? I'd like to see something like this land! |
|
@Fishrock123 sorry, I didn't see that PR couldn't be rebased without conflicts. I fetched current master branch and adapted my code to new source)
new Array((depth - 1) * 2 + 1).join(' ')This part works only with In general, reason of adding was to set "class" attribute in Only one difference appeared after removing find/replace (it was one of reason why I added find/replace): Also similar in Thanks for answers. |
|
That strike-through style might be a bit too much imho, it conveys to me that the component has been removed, which isn't true. How about just adding a tag like GitHub issues have? Could be done through an |
|
The only concern I have with this is that the red link might give the impression that the target is not there. (like red links on Wikipedia). |
|
@silverwind I agree, read my comment above, I prefer to only have the label and leave the link color unchanged as you originally suggested. It's slick and effective imo. |
|
@ilfroloff awesome, I love that. Thanks! |
|
Can anyone test this? I just tried and can't see a difference. No classes seem to have been added. |
|
@silverwind works for me. |
|
Hmm strange, must be something about my setup then. I'm doing |
|
@silverwind that's what I did as well and opened the html files with the browser |
|
Ah, was a bad build cache, |
silverwind
left a comment
There was a problem hiding this comment.
LGTM besides centering nit.
doc/api_assets/style.css
Outdated
There was a problem hiding this comment.
Yep, agreed. I have changed top to .18em
Highlight deprecated API methods/prorepties in "Table of Contents" for increasing understandable Adapted code to eslint standarts
|
@lpinca lgty? |
|
@silverwind yes, I didn't sign off because I'm not very familiar with the doc build tools. |
|
|
||
| module.exports = toHTML; | ||
|
|
||
| const STABILITY_TEXT_REG_EXP = /(.*:)\s(\d)([\s\S]*)/; |
There was a problem hiding this comment.
Would it be better to make the \s greedy, which is before the digits?
| tok.type === 'code') { | ||
| if (tok.text.match(/Stability:.*/g)) { | ||
| const stabilityMatch = tok.text.match(STABILITY_TEXT_REG_EXP); | ||
| const stability = +stabilityMatch[2]; |
There was a problem hiding this comment.
Nit: Number(stabilityMatch[2]) might be cleaner.
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 <fishrock123@rocketmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
|
Landed with greedy regex and number constructor in fcee4d4, thanks! |
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 <fishrock123@rocketmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
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 <fishrock123@rocketmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
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 <fishrock123@rocketmail.com> Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>







Hi All!
Issue rolled up from nodejs/nodejs.org#772 topic.
P.S. I didn't change the color to grey as it's a bit unnoticeable when used with the green color of items.