doc: fix header escaping regression (Issue #22065)#22084
doc: fix header escaping regression (Issue #22065)#22084rubys wants to merge 5 commits intonodejs:masterfrom
Conversation
tools/doc/html.js
Outdated
There was a problem hiding this comment.
Maybe just:
.replace(/\\(?=.)/g, ''),There was a problem hiding this comment.
Or, if we need to exclude escaped escapes:
.replace(/\\(?=[^\\])/g, ''),There was a problem hiding this comment.
jslint doesn't accept .replace(/\\(?=.)/g, ''),:
/Users/rubys/git/node/tools/doc/html.js
202:29 error Unescaped dot character in regular expression node-core/no-unescaped-regexp-dot
I want to include escaped escapes.
Finally, lookahead isn't appropriate here. If we have an escaped escape, I want to emit a single backslash and then to not consider that backslash as an escape character. Consider four escapes in a row, the desired result would be two backslashes:
> "\\\\\\\\".replace(/\\(?=.)/g, '').length
1
> "\\\\\\\\".replace(/\\.{1}/g, (match) => match[1]).length
2
There was a problem hiding this comment.
What about .replace(/\\(.{1})/g, '$1'),? Whould it be simpler and faster then function call and string index access?
There was a problem hiding this comment.
BTW, we can disable linter rule for a line to simplify RegExp, but I am not sure what is more confusing:
// eslint-disable-next-line node-core/no-unescaped-regexp-dot
.replace(/\\./g, (match) => match[1]),|
Not sure what is wrong with CI. Is it infrastructural fails? |
Somebody either changed the version of Between the two, I would say that changing the build script seems considerably more likely. The second slash just looks outright wrong. Perhaps they meant to have a backslash escaping the next backslash so that they shell would pass |
This comment has been minimized.
This comment has been minimized.
|
Looks to be a real failure: https://ci.nodejs.org/job/node-test-commit-linuxone/3483/nodes=rhel72-s390x/consoleFull |
tools/doc/html.js
Outdated
|
Node.js Collaborators, please, add 👍 here if you approve fast-tracking. |
|
It seems we have one more similar regression case: HTML entities verbatim rendering: Not sure if this should be fixed in this PR or in a new one. |
|
@rubys ... just a nit the prefix for the commit message here should be Also, just as a convention, it is helpful to include a |
|
My pull request for https://www.npmjs.com/package/mdast-util-to-hast has been accepted. Updating to the latest version of this dependency should fix everything. In fact, I should be able to back out some of the work that is currently committed. I'll run some tests and see what needs to be done from there. |
|
@rubys ... is this ready to go? |
|
@jasnell: this PR is an accumulated set of workarounds to a remark bug, it certainly can go in now, but will all need to be backed out when these pull requests land: #22140 (comment) |
Preferred long term fix can be found at: nodejs#22140
|
My read is that the freebsd failure is unrelated. Unless there are any objections, I'll land this PR tomorrow. |
|
Landed in 59f8276 |
quick fix for #22065 Preferred long term fix can be found at: nodejs/node#22140 PR-URL: nodejs/node#22084 Fixes: nodejs/node#22065 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Remove backslashes in headers.
Fixes: #22065
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes