Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2019-12-25 02:21:27 +0300
committerRuben Bridgewater <ruben@bridgewater.de>2020-01-03 18:21:58 +0300
commit73c598a905b5d7949f2882dba10418b79512972c (patch)
tree24ed2045489ab73594ba5ea048c301401e61089b /doc
parent9d2082be94fb3887424cabf6fa222c4576c22a4a (diff)
doc,url: use code markup/markdown in headers
PR-URL: https://github.com/nodejs/node/pull/31086 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/url.md108
1 files changed, 54 insertions, 54 deletions
diff --git a/doc/api/url.md b/doc/api/url.md
index 80deff6f4b9..0fb6939d449 100644
--- a/doc/api/url.md
+++ b/doc/api/url.md
@@ -67,7 +67,7 @@ const myURL =
## The WHATWG URL API
-### Class: URL
+### Class: `URL`
<!-- YAML
added:
- v7.0.0
@@ -89,7 +89,7 @@ using the `delete` keyword on any properties of `URL` objects (e.g. `delete
myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still
return `true`.
-#### Constructor: new URL(input\[, base\])
+#### Constructor: `new URL(input[, base])`
* `input` {string} The absolute or relative input URL to parse. If `input`
is relative, then `base` is required. If `input` is absolute, the `base`
@@ -149,7 +149,7 @@ myURL = new URL('foo:Example.com/', 'https://example.org/');
// foo:Example.com/
```
-#### url.hash
+#### `url.hash`
* {string}
@@ -170,7 +170,7 @@ are [percent-encoded][]. The selection of which characters to
percent-encode may vary somewhat from what the [`url.parse()`][] and
[`url.format()`][] methods would produce.
-#### url.host
+#### `url.host`
* {string}
@@ -188,7 +188,7 @@ console.log(myURL.href);
Invalid host values assigned to the `host` property are ignored.
-#### url.hostname
+#### `url.hostname`
* {string}
@@ -208,7 +208,7 @@ console.log(myURL.href);
Invalid hostname values assigned to the `hostname` property are ignored.
-#### url.href
+#### `url.href`
* {string}
@@ -234,7 +234,7 @@ object's properties will be modified.
If the value assigned to the `href` property is not a valid URL, a `TypeError`
will be thrown.
-#### url.origin
+#### `url.origin`
* {string}
@@ -255,7 +255,7 @@ console.log(idnURL.hostname);
// Prints xn--g6w251d
```
-#### url.password
+#### `url.password`
* {string}
@@ -276,7 +276,7 @@ are [percent-encoded][]. The selection of which characters to
percent-encode may vary somewhat from what the [`url.parse()`][] and
[`url.format()`][] methods would produce.
-#### url.pathname
+#### `url.pathname`
* {string}
@@ -297,7 +297,7 @@ property are [percent-encoded][]. The selection of which characters
to percent-encode may vary somewhat from what the [`url.parse()`][] and
[`url.format()`][] methods would produce.
-#### url.port
+#### `url.port`
* {string}
@@ -381,7 +381,7 @@ console.log(myURL.port);
// Prints 4 (because it is the leading number in the string '4.567e21')
```
-#### url.protocol
+#### `url.protocol`
* {string}
@@ -439,7 +439,7 @@ console.log(u.href);
According to the WHATWG URL Standard, special protocol schemes are `ftp`,
`file`, `gopher`, `http`, `https`, `ws`, and `wss`.
-#### url.search
+#### `url.search`
* {string}
@@ -460,7 +460,7 @@ property will be [percent-encoded][]. The selection of which
characters to percent-encode may vary somewhat from what the [`url.parse()`][]
and [`url.format()`][] methods would produce.
-#### url.searchParams
+#### `url.searchParams`
* {URLSearchParams}
@@ -469,7 +469,7 @@ URL. This property is read-only; to replace the entirety of query parameters of
the URL, use the [`url.search`][] setter. See [`URLSearchParams`][]
documentation for details.
-#### url.username
+#### `url.username`
* {string}
@@ -490,7 +490,7 @@ property will be [percent-encoded][]. The selection of which
characters to percent-encode may vary somewhat from what the [`url.parse()`][]
and [`url.format()`][] methods would produce.
-#### url.toString()
+#### `url.toString()`
* Returns: {string}
@@ -501,7 +501,7 @@ Because of the need for standard compliance, this method does not allow users
to customize the serialization process of the URL. For more flexibility,
[`require('url').format()`][] method might be of interest.
-#### url.toJSON()
+#### `url.toJSON()`
* Returns: {string}
@@ -521,7 +521,7 @@ console.log(JSON.stringify(myURLs));
// Prints ["https://www.example.com/","https://test.example.org/"]
```
-### Class: URLSearchParams
+### Class: `URLSearchParams`
<!-- YAML
added:
- v7.5.0
@@ -575,11 +575,11 @@ console.log(myURL.href);
// Prints https://example.org/?a=b&a=c
```
-#### Constructor: new URLSearchParams()
+#### Constructor: `new URLSearchParams()`
Instantiate a new empty `URLSearchParams` object.
-#### Constructor: new URLSearchParams(string)
+#### Constructor: `new URLSearchParams(string)`
* `string` {string} A query string
@@ -600,7 +600,7 @@ console.log(params.toString());
// Prints 'user=abc&query=xyz'
```
-#### Constructor: new URLSearchParams(obj)
+#### Constructor: `new URLSearchParams(obj)`
<!-- YAML
added:
- v7.10.0
@@ -627,7 +627,7 @@ console.log(params.toString());
// Prints 'user=abc&query=first%2Csecond'
```
-#### Constructor: new URLSearchParams(iterable)
+#### Constructor: `new URLSearchParams(iterable)`
<!-- YAML
added:
- v7.10.0
@@ -683,20 +683,20 @@ new URLSearchParams([
// Each query pair must be an iterable [name, value] tuple
```
-#### urlSearchParams.append(name, value)
+#### `urlSearchParams.append(name, value)`
* `name` {string}
* `value` {string}
Append a new name-value pair to the query string.
-#### urlSearchParams.delete(name)
+#### `urlSearchParams.delete(name)`
* `name` {string}
Remove all name-value pairs whose name is `name`.
-#### urlSearchParams.entries()
+#### `urlSearchParams.entries()`
* Returns: {Iterator}
@@ -706,7 +706,7 @@ is the `name`, the second item of the `Array` is the `value`.
Alias for [`urlSearchParams[@@iterator]()`][`urlSearchParams@@iterator()`].
-#### urlSearchParams.forEach(fn\[, thisArg\])
+#### `urlSearchParams.forEach(fn[, thisArg])`
* `fn` {Function} Invoked for each name-value pair in the query
* `thisArg` {Object} To be used as `this` value for when `fn` is called
@@ -723,7 +723,7 @@ myURL.searchParams.forEach((value, name, searchParams) => {
// c d true
```
-#### urlSearchParams.get(name)
+#### `urlSearchParams.get(name)`
* `name` {string}
* Returns: {string} or `null` if there is no name-value pair with the given
@@ -732,7 +732,7 @@ myURL.searchParams.forEach((value, name, searchParams) => {
Returns the value of the first name-value pair whose name is `name`. If there
are no such pairs, `null` is returned.
-#### urlSearchParams.getAll(name)
+#### `urlSearchParams.getAll(name)`
* `name` {string}
* Returns: {string[]}
@@ -740,14 +740,14 @@ are no such pairs, `null` is returned.
Returns the values of all name-value pairs whose name is `name`. If there are
no such pairs, an empty array is returned.
-#### urlSearchParams.has(name)
+#### `urlSearchParams.has(name)`
* `name` {string}
* Returns: {boolean}
Returns `true` if there is at least one name-value pair whose name is `name`.
-#### urlSearchParams.keys()
+#### `urlSearchParams.keys()`
* Returns: {Iterator}
@@ -763,7 +763,7 @@ for (const name of params.keys()) {
// foo
```
-#### urlSearchParams.set(name, value)
+#### `urlSearchParams.set(name, value)`
* `name` {string}
* `value` {string}
@@ -787,7 +787,7 @@ console.log(params.toString());
// Prints foo=def&abc=def&xyz=opq
```
-#### urlSearchParams.sort()
+#### `urlSearchParams.sort()`
<!-- YAML
added:
- v7.7.0
@@ -807,20 +807,20 @@ console.log(params.toString());
// Prints query%5B%5D=abc&query%5B%5D=123&type=search
```
-#### urlSearchParams.toString()
+#### `urlSearchParams.toString()`
* Returns: {string}
Returns the search parameters serialized as a string, with characters
percent-encoded where necessary.
-#### urlSearchParams.values()
+#### `urlSearchParams.values()`
* Returns: {Iterator}
Returns an ES6 `Iterator` over the values of each name-value pair.
-#### urlSearchParams\[Symbol.iterator\]()
+#### `urlSearchParams[Symbol.iterator]()`
* Returns: {Iterator}
@@ -840,7 +840,7 @@ for (const [name, value] of params) {
// xyz baz
```
-### url.domainToASCII(domain)
+### `url.domainToASCII(domain)`
<!-- YAML
added:
- v7.4.0
@@ -865,7 +865,7 @@ console.log(url.domainToASCII('xn--iñvalid.com'));
// Prints an empty string
```
-### url.domainToUnicode(domain)
+### `url.domainToUnicode(domain)`
<!-- YAML
added:
- v7.4.0
@@ -890,7 +890,7 @@ console.log(url.domainToUnicode('xn--iñvalid.com'));
// Prints an empty string
```
-### url.fileURLToPath(url)
+### `url.fileURLToPath(url)`
<!-- YAML
added: v10.12.0
-->
@@ -915,7 +915,7 @@ new URL('file:///hello world').pathname; // Incorrect: /hello%20world
fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX)
```
-### url.format(URL\[, options\])
+### `url.format(URL[, options])`
<!-- YAML
added: v7.6.0
-->
@@ -954,7 +954,7 @@ console.log(url.format(myURL, { fragment: false, unicode: true, auth: false }));
// Prints 'https://測試/?abc'
```
-### url.pathToFileURL(path)
+### `url.pathToFileURL(path)`
<!-- YAML
added: v10.12.0
-->
@@ -993,7 +993,7 @@ changes:
The legacy `urlObject` (`require('url').Url`) is created and returned by the
`url.parse()` function.
-#### urlObject.auth
+#### `urlObject.auth`
The `auth` property is the username and password portion of the URL, also
referred to as _userinfo_. This string subset follows the `protocol` and
@@ -1003,35 +1003,35 @@ by `:`.
For example: `'user:pass'`.
-#### urlObject.hash
+#### `urlObject.hash`
The `hash` property is the fragment identifier portion of the URL including the
leading `#` character.
For example: `'#hash'`.
-#### urlObject.host
+#### `urlObject.host`
The `host` property is the full lower-cased host portion of the URL, including
the `port` if specified.
For example: `'sub.example.com:8080'`.
-#### urlObject.hostname
+#### `urlObject.hostname`
The `hostname` property is the lower-cased host name portion of the `host`
component *without* the `port` included.
For example: `'sub.example.com'`.
-#### urlObject.href
+#### `urlObject.href`
The `href` property is the full URL string that was parsed with both the
`protocol` and `host` components converted to lower-case.
For example: `'http://user:pass@sub.example.com:8080/p/a/t/h?query=string#hash'`.
-#### urlObject.path
+#### `urlObject.path`
The `path` property is a concatenation of the `pathname` and `search`
components.
@@ -1040,7 +1040,7 @@ For example: `'/p/a/t/h?query=string'`.
No decoding of the `path` is performed.
-#### urlObject.pathname
+#### `urlObject.pathname`
The `pathname` property consists of the entire path section of the URL. This
is everything following the `host` (including the `port`) and before the start
@@ -1051,19 +1051,19 @@ For example: `'/p/a/t/h'`.
No decoding of the path string is performed.
-#### urlObject.port
+#### `urlObject.port`
The `port` property is the numeric port portion of the `host` component.
For example: `'8080'`.
-#### urlObject.protocol
+#### `urlObject.protocol`
The `protocol` property identifies the URL's lower-cased protocol scheme.
For example: `'http:'`.
-#### urlObject.query
+#### `urlObject.query`
The `query` property is either the query string without the leading ASCII
question mark (`?`), or an object returned by the [`querystring`][] module's
@@ -1075,7 +1075,7 @@ For example: `'query=string'` or `{'query': 'string'}`.
If returned as a string, no decoding of the query string is performed. If
returned as an object, both keys and values are decoded.
-#### urlObject.search
+#### `urlObject.search`
The `search` property consists of the entire "query string" portion of the
URL, including the leading ASCII question mark (`?`) character.
@@ -1084,13 +1084,13 @@ For example: `'?query=string'`.
No decoding of the query string is performed.
-#### urlObject.slashes
+#### `urlObject.slashes`
The `slashes` property is a `boolean` with a value of `true` if two ASCII
forward-slash characters (`/`) are required following the colon in the
`protocol`.
-### url.format(urlObject)
+### `url.format(urlObject)`
<!-- YAML
added: v0.1.25
changes:
@@ -1181,7 +1181,7 @@ The formatting process operates as follows:
string, an [`Error`][] is thrown.
* `result` is returned.
-### url.parse(urlString\[, parseQueryString\[, slashesDenoteHost\]\])
+### `url.parse(urlString[, parseQueryString[, slashesDenoteHost]])`
<!-- YAML
added: v0.1.25
changes:
@@ -1217,7 +1217,7 @@ A `TypeError` is thrown if `urlString` is not a string.
A `URIError` is thrown if the `auth` property is present but cannot be decoded.
-### url.resolve(from, to)
+### `url.resolve(from, to)`
<!-- YAML
added: v0.1.25
changes: