Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…as literal text String.prototype.replace(placeholder, value) treats some $ sequences in a string replacement as patterns ($$ -> $, $& -> the match, $` / $' -> the template before/after the match). Page content, navigation, man page options/environment text, and sitemap URL fields are filled this way, so any of those sequences in the source produced broken output (e.g. the addons.md Makefile example $$(command -v node) rendered with one $ missing). Pass each value through a replacer function instead, since a function's return value is inserted as-is. Fixes nodejs#1181
Jbansal2
force-pushed
the
fix/legacy-html-dollar-replacement
branch
from
October 28, 2026 09:58
5d2b998 to
0cd7414
Compare
Contributor
|
It's a duplicate of #1186. |
Member
|
Duplicate of #1186 |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
String.prototype.replace(placeholder, value)treats some$sequences in a string second argument as replacement patterns:$$$$&$`$'Page content, navigation, man page options/environment text, and sitemap URL fields are filled this way, so any of those sequences in the source produces broken output. This already shows on nodejs.org: the Makefile example in C++ addons has
$$(command -v node), rendered as$(command -v node)— a literal$lost..replace(placeholder, () => value)) instead, since a function's return value is inserted as-is without$-pattern handling.packages/node-legacy/src/legacy-html/utils/replaceTemplateValues.mjs(used by bothlegacy-htmlandlegacy-html-all).packages/node/src/man-page/generate.mjsandpackages/react/src/sitemap/generate.mjs.replaceTemplateValues.test.mjscovering$$,$&,$`and$'in bothcontentandnav.Fixes #1181
Test plan
node --test packages/node-legacy/src/legacy-html/utils/__tests__/replaceTemplateValues.test.mjspassesnpm run test— no new failures introduced (pre-existing unrelated failures on this environment are incore/jsx-ast/highlighter tests, untouched by this change)npx oxlintclean on changed filesnpx oxfmt --checkclean on changed files