update admonition content formatting (#1896)

* Update crowdin.yml

* update admonition content formatting

Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>

* revert crowdin change

Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>

* missing changes

Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>

---------

Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>
This commit is contained in:
Sebastian Beltran
2025-05-08 14:40:17 -05:00
committed by GitHub
parent b17e3a1446
commit 748c99479a
8 changed files with 77 additions and 14 deletions

View File

@@ -10,7 +10,13 @@ redirect_from: "/4x/api.html"
<h1>4.x API</h1> <h1>4.x API</h1>
{% include admonitions/note.html content="Express 4.0 requires Node.js 0.10 or higher." %} {% capture node-version %}
Express 4.0 requires Node.js 0.10 or higher.
{% endcapture %}
{% include admonitions/note.html content=node-version %}
{% include api/en/4x/express.md %} {% include api/en/4x/express.md %}
{% include api/en/4x/app.md %} {% include api/en/4x/app.md %}

View File

@@ -10,7 +10,13 @@ redirect_from: "/5x/api.html"
<h1>5.x API</h1> <h1>5.x API</h1>
{% include admonitions/note.html content="Express 5.0 requires Node.js 18 or higher." %} {% capture node-version %}
Express 5.0 requires Node.js 18 or higher.
{% endcapture %}
{% include admonitions/note.html content=node-version %}
{% include api/en/5x/express.md %} {% include api/en/5x/express.md %}
{% include api/en/5x/app.md %} {% include api/en/5x/app.md %}

View File

@@ -15,9 +15,14 @@ The term _"production"_ refers to the stage in the software lifecycle when an ap
Development and production environments are usually set up differently and have vastly different requirements. What's fine in development may not be acceptable in production. For example, in a development environment you may want verbose logging of errors for debugging, while the same behavior can become a security concern in a production environment. And in development, you don't need to worry about scalability, reliability, and performance, while those concerns become critical in production. Development and production environments are usually set up differently and have vastly different requirements. What's fine in development may not be acceptable in production. For example, in a development environment you may want verbose logging of errors for debugging, while the same behavior can become a security concern in a production environment. And in development, you don't need to worry about scalability, reliability, and performance, while those concerns become critical in production.
{% include admonitions/note.html content="If you believe you have discovered a security vulnerability in Express, please see {% capture security-note %}
If you believe you have discovered a security vulnerability in Express, please see
[Security Policies and Procedures](/en/resources/contributing.html#security-policies-and-procedures). [Security Policies and Procedures](/en/resources/contributing.html#security-policies-and-procedures).
" %}
{% endcapture %}
{% include admonitions/note.html content=security-note %}
Security best practices for Express applications in production include: Security best practices for Express applications in production include:
@@ -132,10 +137,16 @@ disable using the `app.disable()` method:
app.disable('x-powered-by') app.disable('x-powered-by')
``` ```
{% include admonitions/note.html content="Disabling the `X-Powered-By header` does not prevent {% capture powered-advisory %}
Disabling the `X-Powered-By header` does not prevent
a sophisticated attacker from determining that an app is running Express. It may a sophisticated attacker from determining that an app is running Express. It may
discourage a casual exploit, but there are other ways to determine an app is running discourage a casual exploit, but there are other ways to determine an app is running
Express." %} Express.
{% endcapture %}
{% include admonitions/note.html content=powered-advisory %}
Express also sends its own formatted "404 Not Found" messages and formatter error Express also sends its own formatted "404 Not Found" messages and formatter error
response messages. These can be changed by response messages. These can be changed by

View File

@@ -565,7 +565,12 @@ The 4.14.0 minor release includes bug fixes, security update, performance improv
<li markdown="1" class="changelog-item"> <li markdown="1" class="changelog-item">
The [jshttp/cookie module](https://www.npmjs.com/package/cookie) (in addition to a number of other improvements) has been updated and now the [`res.cookie()` method](/{{ page.lang }}/4x/api.html#res.cookie) supports the `sameSite` option to let you specify the [SameSite cookie attribute](https://tools.ietf.org/html/draft-west-first-party-cookies-07). The [jshttp/cookie module](https://www.npmjs.com/package/cookie) (in addition to a number of other improvements) has been updated and now the [`res.cookie()` method](/{{ page.lang }}/4x/api.html#res.cookie) supports the `sameSite` option to let you specify the [SameSite cookie attribute](https://tools.ietf.org/html/draft-west-first-party-cookies-07).
{% include admonitions/note.html content="This attribute has not yet been fully standardized, may change in the future, and many clients may ignore it." %} {% capture note-4-14-0 %}
This attribute has not yet been fully standardized, may change in the future, and many clients may ignore it.
{% endcapture %}
{% include admonitions/note.html content=note-4-14-0 %}
The possible value for the `sameSite` option are: The possible value for the `sameSite` option are:

View File

@@ -118,8 +118,14 @@ When running through Node.js, you can set a few environment variables that will
| `DEBUG_FD` | File descriptor to write debug output to. | | `DEBUG_FD` | File descriptor to write debug output to. |
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | | `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
{% include admonitions/note.html content="The environment variables beginning with `DEBUG_` end up being {% capture debug-text %}
The environment variables beginning with `DEBUG_` end up being
converted into an Options object that gets used with `%o`/`%O` formatters. converted into an Options object that gets used with `%o`/`%O` formatters.
See the Node.js documentation for See the Node.js documentation for
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) [`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
for the complete list." %} for the complete list.
{% endcapture %}
{% include admonitions/note.html content=debug-text %}

View File

@@ -79,12 +79,20 @@ Route paths, in combination with a request method, define the endpoints at which
{% include admonitions/caution.html content=note-dollar-character %} {% include admonitions/caution.html content=note-dollar-character %}
{% capture note-path-to-regexp %} {% capture note-path-to-regexp %}
Express uses [path-to-regexp](https://www.npmjs.com/package/path-to-regexp) for matching the route paths; see the path-to-regexp documentation for all the possibilities in defining route paths. [Express Playground Router](https://bjohansebas.github.io/playground-router/) is a handy tool for testing basic Express routes, although it does not support pattern matching.
Express uses [path-to-regexp](https://www.npmjs.com/package/path-to-regexp) for matching the route paths; see the path-to-regexp documentation for all the possibilities in defining route paths. [Express Playground Router](https://bjohansebas.github.io/playground-router/) is a handy tool for testing basic Express routes, although it does not support pattern matching.
{% endcapture %} {% endcapture %}
{% include admonitions/note.html content=note-path-to-regexp %} {% include admonitions/note.html content=note-path-to-regexp %}
{% include admonitions/warning.html content="Query strings are not part of the route path." %} {% capture query-string-note %}
Query strings are not part of the route path.
{% endcapture %}
{% include admonitions/warning.html content=query-string-note %}
### Route paths based on strings ### Route paths based on strings
@@ -217,10 +225,19 @@ Request URL: http://localhost:3000/user/42
req.params: {"userId": "42"} req.params: {"userId": "42"}
``` ```
{% include admonitions/warning.html content="Because the regular expression is usually part of a literal string, be sure to escape any `\` characters with an additional backslash, for example `\\d+`." %} {% capture escape-advisory %}
Because the regular expression is usually part of a literal string, be sure to escape any `\` characters with an additional backslash, for example `\\d+`.
{% endcapture %}
{% include admonitions/warning.html content=escape-advisory %}
{% capture warning-version %} {% capture warning-version %}
In Express 4.x, <a href="https://github.com/expressjs/express/issues/2495">the `*` character in regular expressions is not interpreted in the usual way</a>. As a workaround, use `{0,}` instead of `*`. This will likely be fixed in Express 5. In Express 4.x, <a href="https://github.com/expressjs/express/issues/2495">the `*` character in regular expressions is not interpreted in the usual way</a>. As a workaround, use `{0,}` instead of `*`. This will likely be fixed in Express 5.
{% endcapture %} {% endcapture %}
{% include admonitions/warning.html content=warning-version %} {% include admonitions/warning.html content=warning-version %}

View File

@@ -100,7 +100,13 @@ app.get('/user/:id', (req, res, next) => {
To skip the rest of the middleware functions from a router middleware stack, call `next('route')` to pass control to the next route. To skip the rest of the middleware functions from a router middleware stack, call `next('route')` to pass control to the next route.
{% include admonitions/note.html content="`next('route')` will work only in middleware functions that were loaded by using the `app.METHOD()` or `router.METHOD()` functions." %} {% capture next-function %}
`next('route')` will work only in middleware functions that were loaded by using the `app.METHOD()` or `router.METHOD()` functions.
{% endcapture %}
{% include admonitions/note.html content=next-function %}
This example shows a middleware sub-stack that handles GET requests to the `/user/:id` path. This example shows a middleware sub-stack that handles GET requests to the `/user/:id` path.

View File

@@ -41,7 +41,13 @@ A software platform that is used to build scalable network applications. Node.js
When used as an adjective, hyphenate; for example: "This is open-source software." See [Open-source software on Wikipedia](http://en.wikipedia.org/wiki/Open-source_software). When used as an adjective, hyphenate; for example: "This is open-source software." See [Open-source software on Wikipedia](http://en.wikipedia.org/wiki/Open-source_software).
{% include admonitions/note.html content="Although it is common not to hyphenate this term, we are using the standard English rules for hyphenating a compound adjective." %} {% capture english-rules %}
Although it is common not to hyphenate this term, we are using the standard English rules for hyphenating a compound adjective.
{% endcapture %}
{% include admonitions/note.html content=english-rules %}
### request ### request