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/tools
diff options
context:
space:
mode:
authorLuke Arduini <luke.arduini@me.com>2012-12-28 05:32:53 +0400
committerisaacs <i@izs.me>2012-12-28 06:38:56 +0400
commit192192a09e2d2e0d6bdd0934f602d2dbbf10ed06 (patch)
tree2e14a21c6cde70dbbcdc4a23cd2e9aaa77de5985 /tools
parente576208eba9c0b343b9c1510be0839282fa1aff5 (diff)
Colorize API stabilitity index headers in docs
Noted in @shtylman's #3898, API stability notes are easy to overlook in the html documentation. This can be especially troublesome if the API is deprecated. This commit gives visual feedback by adding in a class to the html docs when they're generated. The API headers with corresponding colors are also listed in the 'About this Documentation' page for easy reference.
Diffstat (limited to 'tools')
-rw-r--r--tools/doc/html.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/doc/html.js b/tools/doc/html.js
index 63c7c14074c..087f726a35f 100644
--- a/tools/doc/html.js
+++ b/tools/doc/html.js
@@ -69,6 +69,11 @@ function parseLists(input) {
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 });
+ return;
+ }
if (state === null) {
if (tok.type === 'heading') {
state = 'AFTERHEADING';
@@ -122,6 +127,11 @@ function parseListItem(text) {
return text;
}
+function parseAPIHeader(text) {
+ text = text.replace(/(.*:)\s(\d)([\s\S]*)/,
+ '<pre class="api_stability_$2">$1 $2$3</pre>');
+ return text;
+}
// section is just the first heading
function getSection(lexed) {