Skip to content

Commit 9cf1370

Browse files
estliberitasrvagg
authored andcommitted
doc: improve styling consistency in Buffer docs
Add links style consistency. PR-URL: #5001 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Roman Klauke <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 2750cb0 commit 9cf1370

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

doc/api/buffer.markdown

+16-11
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ console.log(buf2);
115115
Note that when creating a Buffer using the TypeArray's `.buffer`, it is not
116116
currently possible to use only a portion of the underlying `ArrayBuffer`. To
117117
create a Buffer that uses only a part of the `ArrayBuffer`, use the
118-
`buf.slice()` function after the Buffer is created:
118+
[`buf.slice()`][] function after the Buffer is created:
119119

120120
```js
121121
const arr = new Uint16Array(20);
@@ -140,8 +140,8 @@ for (var b of buf)
140140
// 3
141141
```
142142

143-
Additionally, the `buffer.values()`, `buffer.keys()`, and `buffer.entries()`
144-
methods can be used to create iterators.
143+
Additionally, the [`buf.values()`][], [`buf.keys()`][], and
144+
[`buf.entries()`][] methods can be used to create iterators.
145145

146146
## Class: Buffer
147147

@@ -276,7 +276,7 @@ console.log(`${str}: ${str.length} characters, ` +
276276
* Return: {Number}
277277

278278
Compares `buf1` to `buf2` typically for the purpose of sorting arrays of
279-
Buffers. This is equivalent is calling `buf1.compare(buf2)`.
279+
Buffers. This is equivalent is calling [`buf1.compare(buf2)`][].
280280

281281
```js
282282
const arr = [Buffer('1234'), Buffer('0123')];
@@ -499,7 +499,7 @@ Operates similar to [`Array#indexOf()`][] in that it returns either the
499499
starting index position of `value` in Buffer or `-1` if the Buffer does not
500500
contain `value`. The `value` can be a String, Buffer or Number. Strings are by
501501
default interpreted as UTF8. Buffers will use the entire Buffer (to compare a
502-
partial Buffer use [`Buffer#slice()`][]). Numbers can range from 0 to 255.
502+
partial Buffer use [`buf.slice()`][]). Numbers can range from 0 to 255.
503503

504504
```js
505505
const buf = new Buffer('this is a buffer');
@@ -532,9 +532,10 @@ utf16Buffer.indexOf('\u03a3', -4, 'ucs2');
532532
* `encoding` {String} Default: `'utf8'`
533533
* Return: {Boolean}
534534

535-
Operates similar to [Array#includes()][]. The `value` can be a String, Buffer
535+
Operates similar to [`Array#includes()`][]. The `value` can be a String, Buffer
536536
or Number. Strings are interpreted as UTF8 unless overridden with the
537-
`encoding` argument. Buffers will use the entire Buffer (to compare a partial Buffer use `Buffer#slice()`). Numbers can range from 0 to 255.
537+
`encoding` argument. Buffers will use the entire Buffer (to compare a partial
538+
Buffer use [`buf.slice()`][]). Numbers can range from 0 to 255.
538539

539540
The `byteOffset` indicates the index in `buf` where searching begins.
540541

@@ -600,7 +601,7 @@ console.log(buf.length);
600601
While the `length` property is not immutable, changing the value of `length`
601602
can result in undefined and inconsistent behavior. Applications that wish to
602603
modify the length of a Buffer should therefore treat `length` as read-only and
603-
use [`buf.slice`][] to create a new Buffer.
604+
use [`buf.slice()`][] to create a new Buffer.
604605

605606
```js
606607
const buf = new Buffer(10);
@@ -943,7 +944,7 @@ buf.toString(undefined,0,5);
943944

944945
* Return: {Object}
945946

946-
Returns a JSON representation of the Buffer instance. `JSON.stringify`
947+
Returns a JSON representation of the Buffer instance. [`JSON.stringify()`][]
947948
implicitly calls this function when stringifying a Buffer instance.
948949

949950
Example:
@@ -1352,11 +1353,15 @@ has observed undue memory retention in their applications.
13521353

13531354
[iterator]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols
13541355
[`Array#indexOf()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/indexOf
1355-
[Array#includes()]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
1356+
[`Array#includes()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes
13561357
[`buf.fill(0)`]: #buffer_buf_fill_value_offset_end
1357-
[`buf.slice`]: #buffer_buf_slice_start_end
1358+
[`buf.slice()`]: #buffer_buf_slice_start_end
13581359
[`buf1.compare(buf2)`]: #buffer_buf_compare_otherbuffer
13591360
[`Buffer#slice()`]: #buffer_buf_slice_start_end
13601361
[`RangeError`]: errors.html#errors_class_rangeerror
13611362
[`String.prototype.length`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length
13621363
[`util.inspect()`]: util.html#util_util_inspect_object_options
1364+
[`buf.values()`]: #buffer_buf_values
1365+
[`buf.keys()`]: #buffer_buf_keys
1366+
[`buf.entries()`]: #buffer_buf_entries
1367+
[`JSON.stringify()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

0 commit comments

Comments
 (0)