Skip to content

Commit 748c994

Browse files
authored
update admonition content formatting (#1896)
* Update crowdin.yml * update admonition content formatting Signed-off-by: Sebastian Beltran <[email protected]> * revert crowdin change Signed-off-by: Sebastian Beltran <[email protected]> * missing changes Signed-off-by: Sebastian Beltran <[email protected]> --------- Signed-off-by: Sebastian Beltran <[email protected]>
1 parent b17e3a1 commit 748c994

File tree

8 files changed

+77
-14
lines changed

8 files changed

+77
-14
lines changed

en/4x/api.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ redirect_from: "/4x/api.html"
1010

1111
<h1>4.x API</h1>
1212

13-
{% include admonitions/note.html content="Express 4.0 requires Node.js 0.10 or higher." %}
13+
{% capture node-version %}
14+
15+
Express 4.0 requires Node.js 0.10 or higher.
16+
17+
{% endcapture %}
18+
19+
{% include admonitions/note.html content=node-version %}
1420

1521
{% include api/en/4x/express.md %}
1622
{% include api/en/4x/app.md %}

en/5x/api.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ redirect_from: "/5x/api.html"
1010

1111
<h1>5.x API</h1>
1212

13-
{% include admonitions/note.html content="Express 5.0 requires Node.js 18 or higher." %}
13+
{% capture node-version %}
14+
15+
Express 5.0 requires Node.js 18 or higher.
16+
17+
{% endcapture %}
18+
19+
{% include admonitions/note.html content=node-version %}
1420

1521
{% include api/en/5x/express.md %}
1622
{% include api/en/5x/app.md %}

en/advanced/best-practice-security.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,14 @@ The term _"production"_ refers to the stage in the software lifecycle when an ap
1515

1616
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.
1717

18-
{% include admonitions/note.html content="If you believe you have discovered a security vulnerability in Express, please see
18+
{% capture security-note %}
19+
20+
If you believe you have discovered a security vulnerability in Express, please see
1921
[Security Policies and Procedures](/en/resources/contributing.html#security-policies-and-procedures).
20-
" %}
22+
23+
{% endcapture %}
24+
25+
{% include admonitions/note.html content=security-note %}
2126

2227
Security best practices for Express applications in production include:
2328

@@ -132,10 +137,16 @@ disable using the `app.disable()` method:
132137
app.disable('x-powered-by')
133138
```
134139

135-
{% include admonitions/note.html content="Disabling the `X-Powered-By header` does not prevent
140+
{% capture powered-advisory %}
141+
142+
Disabling the `X-Powered-By header` does not prevent
136143
a sophisticated attacker from determining that an app is running Express. It may
137144
discourage a casual exploit, but there are other ways to determine an app is running
138-
Express." %}
145+
Express.
146+
147+
{% endcapture %}
148+
149+
{% include admonitions/note.html content=powered-advisory %}
139150

140151
Express also sends its own formatted "404 Not Found" messages and formatter error
141152
response messages. These can be changed by

en/changelog/index.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,12 @@ The 4.14.0 minor release includes bug fixes, security update, performance improv
565565
<li markdown="1" class="changelog-item">
566566
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).
567567

568-
{% include admonitions/note.html content="This attribute has not yet been fully standardized, may change in the future, and many clients may ignore it." %}
568+
{% capture note-4-14-0 %}
569+
570+
This attribute has not yet been fully standardized, may change in the future, and many clients may ignore it.
571+
572+
{% endcapture %}
573+
{% include admonitions/note.html content=note-4-14-0 %}
569574

570575
The possible value for the `sameSite` option are:
571576

en/guide/debugging.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,14 @@ When running through Node.js, you can set a few environment variables that will
118118
| `DEBUG_FD` | File descriptor to write debug output to. |
119119
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
120120

121-
{% include admonitions/note.html content="The environment variables beginning with `DEBUG_` end up being
121+
{% capture debug-text %}
122+
123+
The environment variables beginning with `DEBUG_` end up being
122124
converted into an Options object that gets used with `%o`/`%O` formatters.
123125
See the Node.js documentation for
124126
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
125-
for the complete list." %}
127+
for the complete list.
128+
129+
{% endcapture %}
130+
131+
{% include admonitions/note.html content=debug-text %}

en/guide/routing.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,20 @@ Route paths, in combination with a request method, define the endpoints at which
7979
{% include admonitions/caution.html content=note-dollar-character %}
8080

8181
{% capture note-path-to-regexp %}
82-
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.
82+
83+
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.
84+
8385
{% endcapture %}
8486

8587
{% include admonitions/note.html content=note-path-to-regexp %}
8688

87-
{% include admonitions/warning.html content="Query strings are not part of the route path." %}
89+
{% capture query-string-note %}
90+
91+
Query strings are not part of the route path.
92+
93+
{% endcapture %}
94+
95+
{% include admonitions/warning.html content=query-string-note %}
8896

8997
### Route paths based on strings
9098

@@ -217,10 +225,19 @@ Request URL: http://localhost:3000/user/42
217225
req.params: {"userId": "42"}
218226
```
219227

220-
{% 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+`." %}
228+
{% capture escape-advisory %}
229+
230+
Because the regular expression is usually part of a literal string, be sure to escape any `\` characters with an additional backslash, for example `\\d+`.
231+
232+
{% endcapture %}
233+
234+
235+
{% include admonitions/warning.html content=escape-advisory %}
221236

222237
{% capture warning-version %}
238+
223239
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.
240+
224241
{% endcapture %}
225242

226243
{% include admonitions/warning.html content=warning-version %}

en/guide/using-middleware.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,13 @@ app.get('/user/:id', (req, res, next) => {
100100

101101
To skip the rest of the middleware functions from a router middleware stack, call `next('route')` to pass control to the next route.
102102

103-
{% 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." %}
103+
{% capture next-function %}
104+
105+
`next('route')` will work only in middleware functions that were loaded by using the `app.METHOD()` or `router.METHOD()` functions.
106+
107+
{% endcapture %}
108+
109+
{% include admonitions/note.html content=next-function %}
104110

105111
This example shows a middleware sub-stack that handles GET requests to the `/user/:id` path.
106112

en/resources/glossary.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ A software platform that is used to build scalable network applications. Node.js
4141

4242
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).
4343

44-
{% 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." %}
44+
{% capture english-rules %}
45+
46+
Although it is common not to hyphenate this term, we are using the standard English rules for hyphenating a compound adjective.
47+
48+
{% endcapture %}
49+
50+
{% include admonitions/note.html content=english-rules %}
4551

4652
### request
4753

0 commit comments

Comments
 (0)