From e4e46de330ddffab029d02ae0bb1d6ece5dd8cf9 Mon Sep 17 00:00:00 2001 From: Shigeki Ohtsu Date: Tue, 5 Jan 2016 18:07:09 +0900 Subject: [PATCH 1/2] doc: fix heading level error in Buffer doc tools/doc/html.js in make doc throws an error in checking a heading level in the markdown file. --- doc/api/buffer.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/buffer.markdown b/doc/api/buffer.markdown index 64dcc67f54f825..090a3eef51acbd 100644 --- a/doc/api/buffer.markdown +++ b/doc/api/buffer.markdown @@ -32,7 +32,7 @@ would need to ever use `require('buffer')`. const buf4 = new Buffer('tést', 'utf8'); // creates a buffer containing UTF8 bytes [74, c3, a9, 73, 74] -### Buffers and Character Encodings +## Buffers and Character Encodings Buffers are commonly used to represent sequences of encoded characters such as UTF8, UCS2, Base64 or even Hex-encoded data. It is possible to @@ -66,7 +66,7 @@ The character encodings currently supported by Node.js include: * `'hex'` - Encode each byte as two hexadecimal characters. -### Buffers and TypedArray +## Buffers and TypedArray Buffers are also `Uint8Array` TypedArray instances. However, there are subtle incompatibilities with the TypedArray specification in ECMAScript 2015. For @@ -116,7 +116,7 @@ create a Buffer that uses only a part of the `ArrayBuffer`, use the console.log(buf.length); // Prints: 16 -### Buffers and ES6 iteration +## Buffers and ES6 iteration Buffers can be iterated over using the ECMAScript 2015 (ES6) `for..of` syntax: From 6cc433f17e9f62917ad3c4e3144654bb6402687e Mon Sep 17 00:00:00 2001 From: Shigeki Ohtsu Date: Tue, 5 Jan 2016 18:11:19 +0900 Subject: [PATCH 2/2] tools: fix warning in doc parsing The description of "[start[, end]]" in the doc shows warning of "invalid param" when parsing an optional parameter in the section. This fixes insufficient trimming of right square brackets. --- tools/doc/json.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/doc/json.js b/tools/doc/json.js index 4c57aefd797eba..07aef469f3e383 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -283,7 +283,7 @@ function parseSignature(text, sig) { // [foo] -> optional if (p.charAt(p.length - 1) === ']') { optional = true; - p = p.substr(0, p.length - 1); + p = p.replace(/\]/g, ''); p = p.trim(); } var eq = p.indexOf('=');