| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
cc @nodejs/documentation @nodejs/website |
Sorry, something went wrong.
There was a problem hiding this comment.
Is this really the cleanest way to do this? Looks super hacky.
Sorry, something went wrong.
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'.
Sorry, something went wrong.
/Users/Jeremiah/Documents/node/.git/rebase-apply/patch:48: trailing whitespace. /Users/Jeremiah/Documents/node/.git/rebase-apply/patch:54: trailing whitespace. /Users/Jeremiah/Documents/node/.git/rebase-apply/patch:124: trailing whitespace. warning: 3 lines applied after fixing whitespace errors. Could you please set git config --global --add core.whitespace fix? thanks! |
Sorry, something went wrong.
|
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 |
Sorry, something went wrong.
There was a problem hiding this comment.
Unnecessary changes?
Sorry, something went wrong.
|
@ilfroloff I'll be willing to review more if you could change less where not necessary. :) |
Sorry, something went wrong.
|
Also if you could run make -j4 lint that would be great! |
Sorry, something went wrong.
|
Thanks for answer. |
Sorry, something went wrong.
|
@Fishrock123 I removed unnecessary changes and resolved error from make -j4 lint command. |
Sorry, something went wrong.
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
Sorry, something went wrong.
|
LGTM minus comments |
Sorry, something went wrong.
|
@Fishrock123 pong) |
Sorry, something went wrong.
|
@Fishrock123 completed. I implemented your suggestions |
Sorry, something went wrong.
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?
Sorry, something went wrong.
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.
Sorry, something went wrong.
|
@ilfroloff It doesn't look like the <li>'s are ever closed with a </li>? |
Sorry, something went wrong.
|
@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! |
Sorry, something went wrong.
|
@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 * because it provides intent of markdown's list. But you replaced * to <li> tag and markdown's parser built incorrect html. In general, reason of adding was to set "class" attribute in <li> tag for restyling all <a> children. But after your question, I rethought and remade code without find/replace of <li>. Now, "class" attribute is set directly to <a> tag. You can check it in update. Thanks for advice) Only one difference appeared after removing find/replace (it was one of reason why I added find/replace): Also similar in punycode module. Thanks for answers. |
Sorry, something went wrong.
|
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 ::after element. |
Sorry, something went wrong.
|
How about something like this? #toc .stability_0:after {
content: "deprecated";
font-size: .8em;
position: relative;
top: -.1em;
margin-left: .3em;
background: #f44;
color: #fff;
padding: .1em .3em;
border-radius: 3px;
} |
Sorry, something went wrong.
Sorry, something went wrong.
|
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). |
Sorry, something went wrong.
|
@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. |
Sorry, something went wrong.
Sorry, something went wrong.
|
@ilfroloff awesome, I love that. Thanks! |
Sorry, something went wrong.
|
Can anyone test this? I just tried and can't see a difference. No classes seem to have been added. |
Sorry, something went wrong.
|
Hmm strange, must be something about my setup then. I'm doing apply-pr 7189 && ./configure && make doc-only && http-server out/doc/api |
Sorry, something went wrong.
|
@silverwind that's what I did as well curl -L https://github.com/nodejs/node/pull/7189.patch | git am make doc-only and opened the html files with the browser |
Sorry, something went wrong.
|
Ah, was a bad build cache, rm -rf out/doc did help. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM besides centering nit.
Sorry, something went wrong.
Sorry, something went wrong.
There was a problem hiding this comment.
Yep, agreed. I have changed top to .18em
Sorry, something went wrong.
Highlight deprecated API methods/prorepties in "Table of Contents" for increasing understandable Adapted code to eslint standarts
|
@silverwind yes, I didn't sign off because I'm not very familiar with the doc build tools. |
Sorry, something went wrong.
|
|
||
| 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?
Sorry, something went wrong.
| 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.
Sorry, something went wrong.
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! |
Sorry, something went wrong.
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>
| Back | FazBrowse Home | New Git URL |
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.