-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
doc: clarify escaping for ES modules #41074
Conversation
doc/api/esm.md
Outdated
@@ -156,7 +156,7 @@ typically configured server. | |||
### URLs | |||
|
|||
ES modules are resolved and cached as URLs. This means that files containing | |||
special characters such as `#` and `?` need to be escaped. | |||
special characters need to be replaced with escape sequences, such as `#` with `%23` and `?` with `%3F`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
special characters need to be replaced with escape sequences, such as `#` with `%23` and `?` with `%3F`. | |
special characters must be [percent-encoded][], such as `#` with `%23` and `?` with `%3F`. |
Then add a new reference at the bottom of the esm.md to:
[percent-encoded]: url.md#percent-encoding-in-urls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe either the bit being changed or the percent-encoding-in-urls
section of url.md
could point to encodeURIComponent()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe either the bit being changed or the
percent-encoding-in-urls
section ofurl.md
could point toencodeURIComponent()
?
Or https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say the link to url.md#percent-encoding-in-urls
suffices here.
The other links could then be referenced in url.md#percent-encoding-in-urls
. (https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding and https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent)
cc @nodejs/modules |
doc/api/esm.md
Outdated
ES modules are resolved and cached as URLs. This means that files containing | ||
special characters such as `#` and `?` need to be escaped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, the word escape does not appear in the relevant MDN doc, so maybe "encoded" is the way to go instead of "escaped" or "replaced with escape sequences". Also, and I know this wasn't introduced in this PR, but "files containing" makes it sound we're talking about the file contents when we're talking about the URL.
ES modules are resolved and cached as URLs. This means that files containing | |
special characters such as `#` and `?` need to be escaped. | |
ES modules are resolved and cached as URLs. This means that characters such as | |
`#` and `?` need to be [percent-encoded][]. |
Then add to the bottom:
[percent-encoding]: https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052
Landed in 3d5a7de |
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052 PR-URL: #41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052 PR-URL: #41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052 PR-URL: #41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052 PR-URL: #41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: nodejs#41052 PR-URL: nodejs#41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
This should make it clear(er) how to escape special characters like `#` and `?`. Ref: #41052 PR-URL: #41074 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
Change proposed according to #41052
This should make it clear how to escape special characters like
#
.I don't know if there are any more, though.
Also, how you would call this in general?
I found it as "Javascript Escape Sequence", is this a known term?
(Also, the first link below contains a dot at the end:
https://github.com/nodejs/node/blob/HEAD/CONTRIBUTING.md.
That should probably be removed.)
Edit: Changed text slightly, so the next check should be successful.