From bd03a37a203d48a6f9262467b0ea937facd9f930 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 16 Jul 2016 00:35:38 +0200 Subject: [PATCH] doc: use blockquotes for Stability: markers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use blockquotes instead of code blocks for stability markers in the docs. Doing that: - Makes the makers appear correctly when viewed e.g. on github. - Allows remark-lint rules like `no-undefined-references` to work properly (https://github.com/nodejs/node/pull/7729). PR-URL: https://github.com/nodejs/node/pull/7757 Reviewed-By: James M Snell Reviewed-By: Сковорода Никита Андреевич Reviewed-By: Michaël Zasso Reviewed-By: Roman Reiss --- doc/api/assert.md | 2 +- doc/api/buffer.md | 2 +- doc/api/child_process.md | 2 +- doc/api/cluster.md | 2 +- doc/api/console.md | 2 +- doc/api/crypto.md | 6 +++--- doc/api/debugger.md | 2 +- doc/api/dgram.md | 2 +- doc/api/dns.md | 2 +- doc/api/documentation.md | 2 +- doc/api/domain.md | 6 +++--- doc/api/events.md | 4 ++-- doc/api/fs.md | 7 ++++--- doc/api/globals.md | 2 +- doc/api/http.md | 4 ++-- doc/api/https.md | 2 +- doc/api/modules.md | 2 +- doc/api/net.md | 4 ++-- doc/api/os.md | 2 +- doc/api/path.md | 2 +- doc/api/punycode.md | 2 +- doc/api/querystring.md | 2 +- doc/api/readline.md | 2 +- doc/api/repl.md | 4 ++-- doc/api/stream.md | 2 +- doc/api/string_decoder.md | 2 +- doc/api/timers.md | 2 +- doc/api/tls.md | 4 ++-- doc/api/tty.md | 4 ++-- doc/api/url.md | 2 +- doc/api/util.md | 42 +++++++++++++++++++-------------------- doc/api/v8.md | 2 +- doc/api/vm.md | 2 +- doc/api/zlib.md | 2 +- tools/doc/README.md | 2 +- tools/doc/html.js | 22 +++++++++++++++++--- tools/doc/json.js | 26 ++++++++++++++++++------ 37 files changed, 107 insertions(+), 76 deletions(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index e54e81d22e384e..716e9809075283 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -1,6 +1,6 @@ # Assert - Stability: 3 - Locked +> Stability: 3 - Locked The `assert` module provides a simple set of assertion tests that can be used to test invariants. The module is intended for internal use by Node.js, but can be diff --git a/doc/api/buffer.md b/doc/api/buffer.md index b75d8fae9ef9de..5b56a71b58e6b5 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -1,6 +1,6 @@ # Buffer - Stability: 2 - Stable +> Stability: 2 - Stable Prior to the introduction of `TypedArray` in ECMAScript 2015 (ES6), the JavaScript language had no mechanism for reading or manipulating streams diff --git a/doc/api/child_process.md b/doc/api/child_process.md index c0a395a044efbd..8675fb3f40fe33 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -1,6 +1,6 @@ # Child Process - Stability: 2 - Stable +> Stability: 2 - Stable The `child_process` module provides the ability to spawn child processes in a manner that is similar, but not identical, to [`popen(3)`][]. This capability diff --git a/doc/api/cluster.md b/doc/api/cluster.md index a96a7caffae6da..3bdc8756b1b68e 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -1,6 +1,6 @@ # Cluster - Stability: 2 - Stable +> Stability: 2 - Stable A single instance of Node.js runs in a single thread. To take advantage of multi-core systems the user will sometimes want to launch a cluster of Node.js diff --git a/doc/api/console.md b/doc/api/console.md index 84e357907427d7..cd546281464d33 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -1,6 +1,6 @@ # Console - Stability: 2 - Stable +> Stability: 2 - Stable The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 43e6167d2ef520..568c6a5d213cda 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1,6 +1,6 @@ # Crypto - Stability: 2 - Stable +> Stability: 2 - Stable The `crypto` module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions. @@ -495,7 +495,7 @@ public point (key) is also generated and set in the ECDH object. ### ecdh.setPublicKey(public_key[, encoding]) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Sets the EC Diffie-Hellman public key. Key encoding can be `'binary'`, `'hex'` or `'base64'`. If `encoding` is provided `public_key` is expected to @@ -892,7 +892,7 @@ The `key` is the raw key used by the `algorithm` and `iv` is an ### crypto.createCredentials(details) - Stability: 0 - Deprecated: Use [`tls.createSecureContext()`][] instead. +> Stability: 0 - Deprecated: Use [`tls.createSecureContext()`][] instead. The `crypto.createCredentials()` method is a deprecated alias for creating and returning a `tls.SecureContext` object. The `crypto.createCredentials()` diff --git a/doc/api/debugger.md b/doc/api/debugger.md index 7b49c6e02d8db4..c47e067b104bb2 100644 --- a/doc/api/debugger.md +++ b/doc/api/debugger.md @@ -1,6 +1,6 @@ # Debugger - Stability: 2 - Stable +> Stability: 2 - Stable diff --git a/doc/api/dgram.md b/doc/api/dgram.md index cf5230ae700b8c..c0a99177bf4c0e 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -1,6 +1,6 @@ # UDP / Datagram Sockets - Stability: 2 - Stable +> Stability: 2 - Stable diff --git a/doc/api/dns.md b/doc/api/dns.md index 3ab20ce01f6e91..933e9e8479e9b6 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -1,6 +1,6 @@ # DNS - Stability: 2 - Stable +> Stability: 2 - Stable The `dns` module contains functions belonging to two different categories: diff --git a/doc/api/documentation.md b/doc/api/documentation.md index 61d623fe3e054a..ffb9a389377c77 100644 --- a/doc/api/documentation.md +++ b/doc/api/documentation.md @@ -64,7 +64,7 @@ Please do not suggest API changes in this area; they will be refused. ## JSON Output - Stability: 1 - Experimental +> Stability: 1 - Experimental Every HTML file in the markdown has a corresponding JSON file with the same data. diff --git a/doc/api/domain.md b/doc/api/domain.md index 41d27c5625f896..62aa761a1f6df0 100644 --- a/doc/api/domain.md +++ b/doc/api/domain.md @@ -1,6 +1,6 @@ # Domain - Stability: 0 - Deprecated +> Stability: 0 - Deprecated **This module is pending deprecation**. Once a replacement API has been finalized, this module will be fully deprecated. Most end users should @@ -436,8 +436,8 @@ without exiting the domain. ### domain.dispose() - Stability: 0 - Deprecated. Please recover from failed IO actions - explicitly via error event handlers set on the domain. +> Stability: 0 - Deprecated. Please recover from failed IO actions +> explicitly via error event handlers set on the domain. Once `dispose` has been called, the domain will no longer be used by callbacks bound into the domain via `run`, `bind`, or `intercept`, and a `'dispose'` event diff --git a/doc/api/events.md b/doc/api/events.md index 6bbb2be9480609..f9b7d64e358b50 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -1,6 +1,6 @@ # Events - Stability: 2 - Stable +> Stability: 2 - Stable @@ -244,7 +244,7 @@ The `'removeListener'` event is emitted *after* a listener is removed. ### EventEmitter.listenerCount(emitter, eventName) - Stability: 0 - Deprecated: Use [`emitter.listenerCount()`][] instead. +> Stability: 0 - Deprecated: Use [`emitter.listenerCount()`][] instead. A class method that returns the number of listeners for the given `eventName` registered on the given `emitter`. diff --git a/doc/api/fs.md b/doc/api/fs.md index f0910d24892907..32994108f21701 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1,6 +1,6 @@ # File System - Stability: 2 - Stable +> Stability: 2 - Stable @@ -476,7 +476,7 @@ added: v0.0.2 deprecated: v1.0.0 --> - Stability: 0 - Deprecated: Use [`fs.stat()`][] or [`fs.access()`][] instead. +> Stability: 0 - Deprecated: Use [`fs.stat()`][] or [`fs.access()`][] instead. Test whether or not the given path exists by checking with the file system. Then call the `callback` argument with either true or false. Example: @@ -499,7 +499,8 @@ added: v0.1.21 deprecated: v1.0.0 --> - Stability: 0 - Deprecated: Use [`fs.statSync()`][] or [`fs.accessSync()`][] instead. +> Stability: 0 - Deprecated: Use [`fs.statSync()`][] or [`fs.accessSync()`][] +> instead. Synchronous version of [`fs.exists()`][]. Returns `true` if the file exists, `false` otherwise. diff --git a/doc/api/globals.md b/doc/api/globals.md index f70c52aae4904e..0121a5269d27c1 100644 --- a/doc/api/globals.md +++ b/doc/api/globals.md @@ -155,7 +155,7 @@ Error. ### require.extensions - Stability: 0 - Deprecated +> Stability: 0 - Deprecated * {Object} diff --git a/doc/api/http.md b/doc/api/http.md index a01408c321d21d..a44fc7d3dc63f5 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -1,6 +1,6 @@ # HTTP - Stability: 2 - Stable +> Stability: 2 - Stable To use the HTTP server and client one must `require('http')`. @@ -1274,7 +1274,7 @@ added: v0.1.13 deprecated: v0.3.6 --> - Stability: 0 - Deprecated: Use [`http.request()`][] instead. +> Stability: 0 - Deprecated: Use [`http.request()`][] instead. Constructs a new HTTP client. `port` and `host` refer to the server to be connected to. diff --git a/doc/api/https.md b/doc/api/https.md index 569bb1e3e6829f..4c515a09b605ae 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -1,6 +1,6 @@ # HTTPS - Stability: 2 - Stable +> Stability: 2 - Stable HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a separate module. diff --git a/doc/api/modules.md b/doc/api/modules.md index 04572a0f972a56..79e18c56902488 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -1,6 +1,6 @@ # Modules - Stability: 3 - Locked +> Stability: 3 - Locked diff --git a/doc/api/net.md b/doc/api/net.md index 0e1099227d0b3d..c42f1a1e65ed70 100644 --- a/doc/api/net.md +++ b/doc/api/net.md @@ -1,6 +1,6 @@ # net - Stability: 2 - Stable +> Stability: 2 - Stable The `net` module provides you with an asynchronous network wrapper. It contains functions for creating both servers and clients (called streams). You can include @@ -97,7 +97,7 @@ added: v0.2.0 deprecated: v0.9.7 --> - Stability: 0 - Deprecated: Use [`server.getConnections()`][] instead. +> Stability: 0 - Deprecated: Use [`server.getConnections()`][] instead. The number of concurrent connections on the server. diff --git a/doc/api/os.md b/doc/api/os.md index 42085356a89b6d..52ac1bd3ec32bd 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -1,6 +1,6 @@ # OS - Stability: 2 - Stable +> Stability: 2 - Stable Provides a few basic operating-system related utility functions. diff --git a/doc/api/path.md b/doc/api/path.md index 7174278ce72127..581c525e0872e0 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -1,6 +1,6 @@ # Path - Stability: 2 - Stable +> Stability: 2 - Stable This module contains utilities for handling and transforming file paths. Almost all these methods perform only string transformations. diff --git a/doc/api/punycode.md b/doc/api/punycode.md index f94ecb16bfff46..fee8a2436683d0 100644 --- a/doc/api/punycode.md +++ b/doc/api/punycode.md @@ -1,6 +1,6 @@ # punycode - Stability: 2 - Stable +> Stability: 2 - Stable [Punycode.js][] is bundled with Node.js v0.5.1+. Use `require('punycode')` to access it. (To use it with other Node.js versions, use npm to install the diff --git a/doc/api/querystring.md b/doc/api/querystring.md index 263f44e1990b44..0e1c01186aea92 100644 --- a/doc/api/querystring.md +++ b/doc/api/querystring.md @@ -1,6 +1,6 @@ # Query String - Stability: 2 - Stable +> Stability: 2 - Stable diff --git a/doc/api/readline.md b/doc/api/readline.md index eddebccc9d31d1..ef6957a89fc6fc 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -1,6 +1,6 @@ # Readline - Stability: 2 - Stable +> Stability: 2 - Stable To use this module, do `require('readline')`. Readline allows reading of a stream (such as [`process.stdin`][]) on a line-by-line basis. diff --git a/doc/api/repl.md b/doc/api/repl.md index b25dd890f46781..6d10f40d7eb60a 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -1,6 +1,6 @@ # REPL - Stability: 2 - Stable +> Stability: 2 - Stable A Read-Eval-Print-Loop (REPL) is available both as a standalone program and easily includable in other programs. The REPL provides a way to interactively @@ -56,7 +56,7 @@ disabled by setting the environment variable `NODE_REPL_HISTORY=""`. ### NODE_REPL_HISTORY_FILE - Stability: 0 - Deprecated: Use `NODE_REPL_HISTORY` instead. +> Stability: 0 - Deprecated: Use `NODE_REPL_HISTORY` instead. Previously in Node.js/io.js v2.x, REPL history was controlled by using a `NODE_REPL_HISTORY_FILE` environment variable, and the history was saved in JSON diff --git a/doc/api/stream.md b/doc/api/stream.md index 5a437459c6700f..34ab5d964d9ea8 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -1,6 +1,6 @@ # Stream - Stability: 2 - Stable +> Stability: 2 - Stable A stream is an abstract interface implemented by various objects in Node.js. For example a [request to an HTTP server][http-incoming-message] is a diff --git a/doc/api/string_decoder.md b/doc/api/string_decoder.md index b24b067602b9ce..410ca5e0c98123 100644 --- a/doc/api/string_decoder.md +++ b/doc/api/string_decoder.md @@ -1,6 +1,6 @@ # StringDecoder - Stability: 2 - Stable +> Stability: 2 - Stable 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 diff --git a/doc/api/timers.md b/doc/api/timers.md index 76b6c505b931df..159481f10aba61 100644 --- a/doc/api/timers.md +++ b/doc/api/timers.md @@ -1,6 +1,6 @@ # Timers - Stability: 3 - Locked +> Stability: 3 - Locked All of the timer functions are globals. You do not need to `require()` this module in order to use them. diff --git a/doc/api/tls.md b/doc/api/tls.md index 271b69d5562aab..d42e062b408f53 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -1,6 +1,6 @@ # TLS (SSL) - Stability: 2 - Stable +> Stability: 2 - Stable Use `require('tls')` to access this module. @@ -159,7 +159,7 @@ is expensive. ## Class: CryptoStream - Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. +> Stability: 0 - Deprecated: Use [`tls.TLSSocket`][] instead. This is an encrypted stream. diff --git a/doc/api/tty.md b/doc/api/tty.md index e7214ce9182c6d..a4164b84b55222 100644 --- a/doc/api/tty.md +++ b/doc/api/tty.md @@ -1,6 +1,6 @@ # TTY - Stability: 2 - Stable +> Stability: 2 - Stable The `tty` module houses the `tty.ReadStream` and `tty.WriteStream` classes. In most cases, you will not need to use this module directly. @@ -95,6 +95,6 @@ terminal. ## tty.setRawMode(mode) - Stability: 0 - Deprecated: Use [tty.ReadStream#setRawMode][] (i.e. process.stdin.setRawMode) instead. +> Stability: 0 - Deprecated: Use [tty.ReadStream#setRawMode][] (i.e. process.stdin.setRawMode) instead. [tty.ReadStream#setRawMode]: #tty_rs_setrawmode_mode diff --git a/doc/api/url.md b/doc/api/url.md index f8c2980bd568bc..7c6b84a7fd7724 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -1,6 +1,6 @@ # URL - Stability: 2 - Stable +> Stability: 2 - Stable This module has utilities for URL resolution and parsing. Call `require('url')` to use it. diff --git a/doc/api/util.md b/doc/api/util.md index d3d26dbb946774..7c6f572e15aefb 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1,6 +1,6 @@ # util - Stability: 2 - Stable +> Stability: 2 - Stable These functions are in the module `'util'`. Use `require('util')` to access them. @@ -14,7 +14,7 @@ are unnecessary for Node.js's internal functionality. ## util.debug(string) - Stability: 0 - Deprecated: Use [`console.error()`][] instead. +> Stability: 0 - Deprecated: Use [`console.error()`][] instead. Deprecated predecessor of `console.error`. @@ -83,7 +83,7 @@ when the deprecated API is used. Configurable at run-time through the ## util.error([...]) - Stability: 0 - Deprecated: Use [`console.error()`][] instead. +> Stability: 0 - Deprecated: Use [`console.error()`][] instead. Deprecated predecessor of `console.error`. @@ -250,7 +250,7 @@ util.inspect(obj); ## util.isArray(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Internal alias for [`Array.isArray`][]. @@ -269,7 +269,7 @@ util.isArray({}) ## util.isBoolean(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is a `Boolean`. Otherwise, returns `false`. @@ -286,7 +286,7 @@ util.isBoolean(false) ## util.isBuffer(object) - Stability: 0 - Deprecated: Use [`Buffer.isBuffer()`][] instead. +> Stability: 0 - Deprecated: Use [`Buffer.isBuffer()`][] instead. Returns `true` if the given "object" is a `Buffer`. Otherwise, returns `false`. @@ -303,7 +303,7 @@ util.isBuffer(new Buffer('hello world')) ## util.isDate(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is a `Date`. Otherwise, returns `false`. @@ -320,7 +320,7 @@ util.isDate({}) ## util.isError(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is an [`Error`][]. Otherwise, returns `false`. @@ -338,7 +338,7 @@ util.isError({ name: 'Error', message: 'an error occurred' }) ## util.isFunction(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is a `Function`. Otherwise, returns `false`. @@ -359,7 +359,7 @@ util.isFunction(Bar) ## util.isNull(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is strictly `null`. Otherwise, returns `false`. @@ -377,7 +377,7 @@ util.isNull(null) ## util.isNullOrUndefined(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is `null` or `undefined`. Otherwise, returns `false`. @@ -395,7 +395,7 @@ util.isNullOrUndefined(null) ## util.isNumber(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is a `Number`. Otherwise, returns `false`. @@ -414,7 +414,7 @@ util.isNumber(NaN) ## util.isObject(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is strictly an `Object` __and__ not a `Function`. Otherwise, returns `false`. @@ -434,7 +434,7 @@ util.isObject(function(){}) ## util.isPrimitive(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is a primitive type. Otherwise, returns `false`. @@ -464,7 +464,7 @@ util.isPrimitive(new Date()) ## util.isRegExp(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is a `RegExp`. Otherwise, returns `false`. @@ -481,7 +481,7 @@ util.isRegExp({}) ## util.isString(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is a `String`. Otherwise, returns `false`. @@ -500,7 +500,7 @@ util.isString(5) ### util.isSymbol(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is a `Symbol`. Otherwise, returns `false`. @@ -517,7 +517,7 @@ util.isSymbol(Symbol('foo')) ## util.isUndefined(object) - Stability: 0 - Deprecated +> Stability: 0 - Deprecated Returns `true` if the given "object" is `undefined`. Otherwise, returns `false`. @@ -541,19 +541,19 @@ Output with timestamp on `stdout`. ## util.print([...]) - Stability: 0 - Deprecated: Use [`console.log()`][] instead. +> Stability: 0 - Deprecated: Use [`console.log()`][] instead. Deprecated predecessor of `console.log`. ## util.pump(readableStream, writableStream[, callback]) - Stability: 0 - Deprecated: Use readableStream.pipe(writableStream) +> Stability: 0 - Deprecated: Use readableStream.pipe(writableStream) Deprecated predecessor of `stream.pipe()`. ## util.puts([...]) - Stability: 0 - Deprecated: Use [`console.log()`][] instead. +> Stability: 0 - Deprecated: Use [`console.log()`][] instead. Deprecated predecessor of `console.log`. diff --git a/doc/api/v8.md b/doc/api/v8.md index f0ab08cfeb6d47..f74d76820cbf3f 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -1,6 +1,6 @@ # V8 - Stability: 2 - Stable +> Stability: 2 - Stable This module exposes events and interfaces specific to the version of [V8][] built with Node.js. These interfaces are subject to change by upstream and are diff --git a/doc/api/vm.md b/doc/api/vm.md index 8cc1f71ef140f5..a09c3bf20ca722 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -1,6 +1,6 @@ # Executing JavaScript - Stability: 2 - Stable +> Stability: 2 - Stable diff --git a/doc/api/zlib.md b/doc/api/zlib.md index 408cade112d6bf..9bdd8913bbbcbd 100644 --- a/doc/api/zlib.md +++ b/doc/api/zlib.md @@ -1,6 +1,6 @@ # Zlib - Stability: 2 - Stable +> Stability: 2 - Stable You can access this module with: diff --git a/tools/doc/README.md b/tools/doc/README.md index 1620d6c25acbc9..e472c712dc0a52 100644 --- a/tools/doc/README.md +++ b/tools/doc/README.md @@ -10,7 +10,7 @@ Each type of heading has a description block. added: v0.10.0 --> - Stability: 3 - Stable + > Stability: 3 - Stable description and examples. diff --git a/tools/doc/html.js b/tools/doc/html.js index 75d5f085311601..30bc3b5caae303 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -150,15 +150,31 @@ function parseText(lexed) { // lists that come right after a heading are what we're after. function parseLists(input) { var state = null; + var savedState = []; var depth = 0; var output = []; output.links = input.links; input.forEach(function(tok) { - if (tok.type === 'code' && tok.text.match(/Stability:.*/g)) { - tok.text = parseAPIHeader(tok.text); - output.push({ type: 'html', text: tok.text }); + if (tok.type === 'blockquote_start') { + savedState.push(state); + state = 'MAYBE_STABILITY_BQ'; return; } + if (tok.type === 'blockquote_end' && state === 'MAYBE_STABILITY_BQ') { + state = savedState.pop(); + return; + } + if ((tok.type === 'paragraph' && state === 'MAYBE_STABILITY_BQ') || + tok.type === 'code') { + if (tok.text.match(/Stability:.*/g)) { + tok.text = parseAPIHeader(tok.text); + output.push({ type: 'html', text: tok.text }); + return; + } else if (state === 'MAYBE_STABILITY_BQ') { + output.push({ type: 'blockquote_start' }); + state = savedState.pop(); + } + } if (state === null || (state === 'AFTERHEADING' && tok.type === 'heading')) { if (tok.type === 'heading') { diff --git a/tools/doc/json.js b/tools/doc/json.js index 33bde6515b1235..f5bce301056a48 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -82,19 +82,19 @@ function doJSON(input, filename, cb) { // Immediately after a heading, we can expect the following // - // { type: 'code', text: 'Stability: ...' }, + // { type: 'blockquote_start' } + // { type: 'paragraph', text: 'Stability: ...' }, + // { type: 'blockquote_end' } // // a list: starting with list_start, ending with list_end, // maybe containing other nested lists in each item. // - // If one of these isnt' found, then anything that comes between + // If one of these isn't found, then anything that comes between // here and the next heading should be parsed as the desc. var stability; if (state === 'AFTERHEADING') { - if (type === 'code' && - (stability = text.match(/^Stability: ([0-5])(?:\s*-\s*)?(.*)$/))) { - current.stability = parseInt(stability[1], 10); - current.stabilityText = stability[2].trim(); + if (type === 'blockquote_start') { + state = 'AFTERHEADING_BLOCKQUOTE'; return; } else if (type === 'list_start' && !tok.ordered) { state = 'AFTERHEADING_LIST'; @@ -129,6 +129,20 @@ function doJSON(input, filename, cb) { return; } + if (state === 'AFTERHEADING_BLOCKQUOTE') { + if (type === 'blockquote_end') { + state = 'AFTERHEADING'; + return; + } + + if (type === 'paragraph' && + (stability = text.match(/^Stability: ([0-5])(?:\s*-\s*)?(.*)$/))) { + current.stability = parseInt(stability[1], 10); + current.stabilityText = stability[2].trim(); + return; + } + } + current.desc = current.desc || []; current.desc.push(tok);