Gathering detailed insights and metrics for dox
Gathering detailed insights and metrics for dox
Gathering detailed insights and metrics for dox
Gathering detailed insights and metrics for dox
html-dox
html dox is a reactive sequential dom lib aimed to make html more manageable and faster!
dox-editor
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
dox-foundation
HTML output for Dox documentation generator
doxdox-parser-dox
dox parser for doxdox
JavaScript documentation generator for node using markdown and jsdoc
npm install dox
Typescript
Module System
Node Version
NPM Version
98.9
Supply Chain
100
Quality
79.8
Maintenance
100
Vulnerability
99.6
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
2,155 Stars
509 Commits
194 Forks
38 Watchers
2 Branches
37 Contributors
Updated on May 01, 2025
Minified
Minified + Gzipped
Latest Version
1.0.0
Package Id
dox@1.0.0
Unpacked Size
44.97 kB
Size
13.52 kB
File Count
11
NPM Version
8.18.0
Node Version
16.16.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
Dox is a JavaScript documentation generator written with node. Dox no longer generates an opinionated structure or style for your docs, it simply gives you a JSON representation, allowing you to use markdown and JSDoc-style tags.
Install from npm:
$ npm install -g dox
dox(1)
operates over stdio:
$ dox < utils.js
...JSON...
to inspect the generated data you can use the --debug
flag, which is easier to read than the JSON output:
$ dox --debug < utils.js
utils.js:
1/** 2 * Escape the given `html`. 3 * 4 * @example 5 * utils.escape('<script></script>') 6 * // => '<script></script>' 7 * 8 * @param {String} html string to be escaped 9 * @return {String} escaped html 10 * @api public 11 */ 12 13exports.escape = function(html){ 14 return String(html) 15 .replace(/&(?!\w+;)/g, '&') 16 .replace(/</g, '<') 17 .replace(/>/g, '>'); 18};
output:
1[ 2 { 3 "tags": [ 4 { 5 "type": "example", 6 "string": " utils.escape('<script></script>')\n // => '<script></script>'", 7 "html": "<pre><code>utils.escape('<script></script>')\n// => '&lt;script&gt;&lt;/script&gt;'\n</code></pre>" 8 }, 9 { 10 "type": "param", 11 "string": "{String} html string to be escaped", 12 "types": [ 13 "String" 14 ], 15 "name": "html", 16 "description": "string to be escaped" 17 }, 18 { 19 "type": "return", 20 "string": "{String} escaped html", 21 "types": [ 22 "String" 23 ], 24 "description": "escaped html" 25 }, 26 { 27 "type": "api", 28 "string": "public", 29 "visibility": "public" 30 } 31 ], 32 "description": { 33 "full": "<p>Escape the given <code>html</code>.</p>", 34 "summary": "<p>Escape the given <code>html</code>.</p>", 35 "body": "" 36 }, 37 "isPrivate": false, 38 "ignore": false, 39 "code": "exports.escape = function(html){\n return String(html)\n .replace(/&(?!\\w+;)/g, '&')\n .replace(/</g, '<')\n .replace(/>/g, '>');\n};", 40 "ctx": { 41 "type": "method", 42 "receiver": "exports", 43 "name": "escape", 44 "string": "exports.escape()" 45 } 46 } 47]
This output can then be passed to a template for rendering. Look below at the "Properties" section for details.
Usage: dox [options]
Options:
-h, --help output usage information
-V, --version output the version number
-r, --raw output "raw" comments, leaving the markdown intact
-a, --api output markdown readme documentation
-s, --skipPrefixes [prefixes] skip comments prefixed with these prefixes, separated by commas
-d, --debug output parsed comments for debugging
-S, --skipSingleStar set to false to ignore `/* ... */` comments
Examples:
# stdin
$ dox > myfile.json
# operates over stdio
$ dox < myfile.js > myfile.json
1 2var dox = require('dox'), 3 code = "..."; 4 5var obj = dox.parseComments(code); 6 7// [{ tags:[ ... ], description, ... }, { ... }, ...] 8
A "comment" is comprised of the following detailed properties:
- tags
- description
- isPrivate
- isEvent
- isConstructor
- line
- ignore
- code
- ctx
A dox description is comprised of three parts, the "full" description, the "summary", and the "body". The following example has only a "summary", as it consists of a single paragraph only, therefore the "full" property has only this value as well.
1/** 2 * Output the given `str` to _stdout_. 3 */ 4 5exports.write = function(str) { 6 process.stdout.write(str); 7};
yields:
1description: 2 { full: '<p>Output the given <code>str</code> to <em>stdout</em>.</p>', 3 summary: '<p>Output the given <code>str</code> to <em>stdout</em>.</p>', 4 body: '' },
Large descriptions might look something like the following, where the "summary" is still the first paragraph, the remaining description becomes the "body". Keep in mind this is markdown, so you can indent code, use lists, links, etc. Dox also augments markdown, allowing "Some Title:\n" to form a header.
1/** 2 * Output the given `str` to _stdout_ 3 * or the stream specified by `options`. 4 * 5 * Options: 6 * 7 * - `stream` defaulting to _stdout_ 8 * 9 * Examples: 10 * 11 * mymodule.write('foo') 12 * mymodule.write('foo', { stream: process.stderr }) 13 * 14 */ 15 16exports.write = function(str, options) { 17 options = options || {}; 18 (options.stream || process.stdout).write(str); 19};
yields:
1description: 2 { full: '<p>Output the given <code>str</code> to <em>stdout</em><br />or the stream specified by <code>options</code>.</p>\n\n<h2>Options</h2>\n\n<ul>\n<li><code>stream</code> defaulting to <em>stdout</em></li>\n</ul>\n\n<h2>Examples</h2>\n\n<pre><code>mymodule.write(\'foo\')\nmymodule.write(\'foo\', { stream: process.stderr })\n</code></pre>', 3 summary: '<p>Output the given <code>str</code> to <em>stdout</em><br />or the stream specified by <code>options</code>.</p>', 4 body: '<h2>Options</h2>\n\n<ul>\n<li><code>stream</code> defaulting to <em>stdout</em></li>\n</ul>\n\n<h2>Examples</h2>\n\n<pre><code>mymodule.write(\'foo\')\nmymodule.write(\'foo\', { stream: process.stderr })\n</code></pre>' }
Dox also supports JSdoc-style tags. Currently only @api is special-cased, providing the comment.isPrivate
boolean so you may omit "private" utilities etc.
1 2/** 3 * Output the given `str` to _stdout_ 4 * or the stream specified by `options`. 5 * 6 * @param {String} str 7 * @param {{stream: Writable}} options 8 * @return {Object} exports for chaining 9 */ 10 11exports.write = function(str, options) { 12 options = options || {}; 13 (options.stream || process.stdout).write(str); 14 return this; 15};
yields:
1tags: 2 [ { type: 'param', 3 string: '{String} str', 4 types: [ 'String' ], 5 name: 'str', 6 description: '' }, 7 { type: 'param', 8 string: '{{stream: Writable}} options', 9 types: [ { stream: ['Writable'] } ], 10 name: 'options', 11 description: '' }, 12 { type: 'return', 13 string: '{Object} exports for chaining', 14 types: [ 'Object' ], 15 description: 'exports for chaining' }, 16 { type: 'api', 17 visibility: 'public' } ]
dox supports all jsdoc type strings specified in the jsdoc documentation. You can
specify complex object types including optional flag =
, nullable ?
, non-nullable !
and variable arguments ...
.
Additionally you can use typesDescription
which contains formatted HTML for displaying complex types.
1 2/** 3 * Generates a person information string based on input. 4 * 5 * @param {string | {name: string, age: number | date}} name Name or person object 6 * @param {{separator: string} =} options An options object 7 * @return {string} The constructed information string 8 */ 9 10exports.generatePersonInfo = function(name, options) { 11 var str = ''; 12 var separator = options && options.separator ? options.separator : ' '; 13 14 if(typeof name === 'object') { 15 str = [name.name, '(', name.age, ')'].join(separator); 16 } else { 17 str = name; 18 } 19};
yields:
1tags: 2[ 3 { 4 "tags": [ 5 { 6 "type": "param", 7 "string": "{string | {name: string, age: number | date}} name Name or person object", 8 "name": "name", 9 "description": "Name or person object", 10 "types": [ 11 "string", 12 { 13 "name": [ 14 "string" 15 ], 16 "age": [ 17 "number", 18 "date" 19 ] 20 } 21 ], 22 "typesDescription": "<code>string</code>|{ name: <code>string</code>, age: <code>number</code>|<code>date</code> }", 23 "optional": false, 24 "nullable": false, 25 "nonNullable": false, 26 "variable": false 27 }, 28 { 29 "type": "param", 30 "string": "{{separator: string} =} options An options object", 31 "name": "options", 32 "description": "An options object", 33 "types": [ 34 { 35 "separator": [ 36 "string" 37 ] 38 } 39 ], 40 "typesDescription": "{ separator: <code>string</code> }|<code>undefined</code>", 41 "optional": true, 42 "nullable": false, 43 "nonNullable": false, 44 "variable": false 45 }, 46 { 47 "type": "return", 48 "string": "{string} The constructed information string", 49 "types": [ 50 "string" 51 ], 52 "typesDescription": "<code>string</code>", 53 "optional": false, 54 "nullable": false, 55 "nonNullable": false, 56 "variable": false, 57 "description": "The constructed information string" 58 } 59 ]
The .code
property is the code following the comment block, in our previous examples:
1exports.write = function(str, options) { 2 options = options || {}; 3 (options.stream || process.stdout).write(str); 4 return this; 5};
The .ctx
object indicates the context of the code block, is it a method, a function, a variable etc. Below are some examples:
1exports.write = function(str, options) { 2};
yields:
1ctx: 2 { type: 'method', 3 receiver: 'exports', 4 name: 'write', 5 string: 'exports.write()' } }
1var foo = 'bar';
yields:
1ctx: 2 { type: 'declaration', 3 name: 'foo', 4 value: '\'bar\'', 5 string: 'foo' }
1function User() { 2 3}
yields:
1ctx: 2 { type: 'function', 3 name: 'User', 4 string: 'User()' } }
Context matching in dox is done by performing pattern matching against the code following a
comment block. dox.contextPatternMatchers
is an array of all pattern matching functions,
which dox will iterate over until one of them returns a result. If none return a result,
then the comment block does not receive a ctx
value.
This array is exposed to allow for extension of unsupported context patterns by adding more functions. Each function is passed the code following the comment block and (if detected) the parent context if the block.
1dox.contextPatternMatchers.push(function (str, parentContext) { 2 // return a context object if found 3 // return false otherwise 4});
Comments and their associated bodies of code may be flagged with "!" to be considered worth ignoring, these are typically things like file comments containing copyright etc, however you of course can output them in your templates if you want.
/**
* Not ignored.
*/
vs
/*!
* Ignored.
*/
You may use -S
, --skipSingleStar
or {skipSingleStar: true}
to ignore /* ... */
comments.
Install dev dependencies and execute make test
:
$ npm install -d
$ make test
(The MIT License)
Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
4 existing vulnerabilities detected
Details
Reason
Found 2/7 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More