FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

doc: clarify escaping for ES modules by notroid5 · Pull Request #41074 · nodejs/node · GitHub

/ node Public

doc: clarify escaping for ES modules - #41074

Merged
nodejs-github-bot merged 1 commit into
nodejs:masterfrom
notroid5:patch-1
Dec 7, 2021
Merged

doc: clarify escaping for ES modules#41074
nodejs-github-bot merged 1 commit into
nodejs:masterfrom
notroid5:patch-1

Conversation

notroid5 commented Dec 3, 2021
edited
Loading

Copy link
Copy Markdown
Contributor

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.

nodejs-github-bot added doc Issues and PRs related to the documentations. esm Issues and PRs related to the ECMAScript Modules implementation. labels Dec 3, 2021
Comment thread doc/api/esm.md Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality
Suggested change
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe either the bit being changed or the percent-encoding-in-urls section of url.md could point to encodeURIComponent()?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe either the bit being changed or the percent-encoding-in-urls section of url.md could point to encodeURIComponent()?

Or https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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)

ljharb commented Dec 3, 2021

Copy link
Copy Markdown
Member

cc @nodejs/modules

Comment thread doc/api/esm.md Outdated
Comment on lines 158 to 159

Trott Dec 3, 2021
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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.

Suggested change
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

notroid5 changed the title Clarify escaping for ES modules Doc: Clarify escaping for ES modules Dec 4, 2021
This should make it clear(er) how to escape special characters like `#`
and `?`.

Ref: #41052
Trott changed the title Doc: Clarify escaping for ES modules doc: clarify escaping for ES modules Dec 4, 2021
Trott added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Dec 4, 2021
aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 7, 2021
nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Dec 7, 2021
nodejs-github-bot merged commit 3d5a7de into nodejs:master Dec 7, 2021

Copy link
Copy Markdown
Collaborator

Landed in 3d5a7de

notroid5 deleted the patch-1 branch December 7, 2021 16:00
danielleadams pushed a commit that referenced this pull request Dec 14, 2021
This should make it clear(er) how to escape special characters like `#`
and `?`.

Ref: #41052

PR-URL: #41074
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
danielleadams pushed a commit that referenced this pull request Jan 31, 2022
This should make it clear(er) how to escape special characters like `#`
and `?`.

Ref: #41052

PR-URL: #41074
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
danielleadams pushed a commit that referenced this pull request Jan 31, 2022
This should make it clear(er) how to escape special characters like `#`
and `?`.

Ref: #41052

PR-URL: #41074
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
danielleadams pushed a commit that referenced this pull request Feb 1, 2022
This should make it clear(er) how to escape special characters like `#`
and `?`.

Ref: #41052

PR-URL: #41074
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
danielleadams mentioned this pull request Feb 1, 2022
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

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. doc Issues and PRs related to the documentations. esm Issues and PRs related to the ECMAScript Modules implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants


Back | FazBrowse Home | New Git URL