Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
jsdoc-to-markdown
Advanced tools
Generates markdown API documentation from jsdoc annotated source code
The jsdoc-to-markdown npm package is a tool that generates markdown documentation from JSDoc comments in your JavaScript code. It is useful for creating comprehensive and readable documentation for your projects.
Generate Markdown Documentation
This feature allows you to generate markdown documentation from JSDoc comments in your JavaScript files. The code sample demonstrates how to use jsdoc-to-markdown to read JSDoc comments from JavaScript files in the 'src' directory and output the generated markdown to 'docs/api.md'.
const jsdoc2md = require('jsdoc-to-markdown');
const fs = require('fs');
const inputFiles = 'src/**/*.js';
const outputFile = 'docs/api.md';
jsdoc2md.render({ files: inputFiles })
.then(output => fs.writeFileSync(outputFile, output));
Customizing the Output
This feature allows you to customize the output of the generated markdown documentation using a template. The code sample shows how to use a custom template to format the documentation for a specific module.
const jsdoc2md = require('jsdoc-to-markdown');
const fs = require('fs');
const inputFiles = 'src/**/*.js';
const outputFile = 'docs/api.md';
const template = `{{#module name="myModule"}}{{>docs}}{{/module}}`;
jsdoc2md.render({ files: inputFiles, template: template })
.then(output => fs.writeFileSync(outputFile, output));
Filtering Output
This feature allows you to filter the output of the generated markdown documentation. The code sample demonstrates how to disable GitHub Flavored Markdown (GFM) in the output by setting the 'no-gfm' option to true.
const jsdoc2md = require('jsdoc-to-markdown');
const fs = require('fs');
const inputFiles = 'src/**/*.js';
const outputFile = 'docs/api.md';
jsdoc2md.render({ files: inputFiles, 'no-gfm': true })
.then(output => fs.writeFileSync(outputFile, output));
The 'documentation' package is another tool for generating documentation from JSDoc comments. It offers a command-line interface and supports various output formats, including HTML and JSON. Compared to jsdoc-to-markdown, 'documentation' provides more flexibility in terms of output formats but may require more configuration.
The 'jsdoc' package is a popular tool for generating HTML documentation from JSDoc comments. It is highly configurable and supports a wide range of tags and plugins. While 'jsdoc' focuses on generating HTML documentation, jsdoc-to-markdown is specialized in generating markdown documentation, making it more suitable for projects that prefer markdown.
The 'esdoc' package is a documentation generator for JavaScript that supports ES6+ syntax. It generates HTML documentation and includes features like coverage reports and test integration. Compared to jsdoc-to-markdown, 'esdoc' is more focused on modern JavaScript syntax and provides additional features like coverage reports.
Upgraders, please read the release notes
Generates markdown API documentation from jsdoc annotated source code. Useful for injecting API docs into project README files.
1. Document your code using valid jsdoc comments.
/**
* A quite wonderful function.
* @param {object} - Privacy gown
* @param {object} - Security
* @returns {survival}
*/
function protection (cloak, dagger) {}
2. Run a command.
$ jsdoc2md example.js
3. Get markdown output.
## protection(cloak, dagger) ⇒ <code>survival</code>
A quite wonderful function.
**Kind**: global function
| Param | Type | Description |
| ------ | ------------------- | ------------ |
| cloak | <code>object</code> | Privacy gown |
| dagger | <code>object</code> | Security |
$ npm install --save-dev jsdoc-to-markdown
© 2014-24 Lloyd Brookes <75pound@gmail.com>.
Tested by test-runner.
FAQs
Generates markdown API documentation from jsdoc annotated source code
We found that jsdoc-to-markdown demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.