doc: fenced all code blocks, typo fixes

This changes the code blocks from 4-space indentation to ``` fences for
better syntax highlighting and future linting support. Minor On-the-fly
changes for typos and highlight breaking markdown have been made.

JSON-Style objects have been changed so their closing bracket is
on the same line as the opening one.

Known issues:
* Not every JSON / object notation has been improved. Should
  make another run for this.
* Some example functions break hightlighting due to various
  combinations of brackets. However changing them means leaving
  the code style.

Fixes: https://github.com/nodejs/node/issues/4726
PR-URL: https://github.com/nodejs/node/pull/4733
Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
Robert Jefe Lindstaedt authored and Myles Borins committed 2016-03-02 14:01:11 -08:00
1 parent 3ca6d750b9
commit 3624eaf691
36 files changed
+4891 -3913

No files matched your search

+8 -6
View File
@@ -6,14 +6,16 @@ To use this module, do `require('string_decoder')`. StringDecoder decodes a
buffer to a string. It is a simple interface to `buffer.toString()` but provides
additional support for utf8.
const StringDecoder = require('string_decoder').StringDecoder;
const decoder = new StringDecoder('utf8');
```js
const StringDecoder = require('string_decoder').StringDecoder;
const decoder = new StringDecoder('utf8');
const cent = new Buffer([0xC2, 0xA2]);
console.log(decoder.write(cent));
const cent = new Buffer([0xC2, 0xA2]);
console.log(decoder.write(cent));
const euro = new Buffer([0xE2, 0x82, 0xAC]);
console.log(decoder.write(euro));
const euro = new Buffer([0xE2, 0x82, 0xAC]);
console.log(decoder.write(euro));
```
## Class: StringDecoder