Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
The dmd (documentation markdown) npm package is a tool for generating markdown documentation from JSDoc comments in your JavaScript code. It allows you to create well-structured 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 dmd in conjunction with jsdoc-to-markdown to read JSDoc data from a file and convert it into markdown format.
const dmd = require('dmd');
const jsdoc2md = require('jsdoc-to-markdown');
const jsdocData = jsdoc2md.getTemplateDataSync({ files: 'your-file.js' });
const output = dmd(jsdocData);
console.log(output);
Custom Templates
This feature allows you to use custom templates to format the generated markdown documentation. The code sample shows how to define a custom template and use it with dmd to generate documentation.
const dmd = require('dmd');
const jsdoc2md = require('jsdoc-to-markdown');
const jsdocData = jsdoc2md.getTemplateDataSync({ files: 'your-file.js' });
const template = '{{#module}}{{name}}{{/module}}';
const output = dmd(jsdocData, { template: template });
console.log(output);
Helper Functions
This feature allows you to define and use custom helper functions in your templates. The code sample demonstrates how to create a helper function that converts text to uppercase and use it in the generated documentation.
const dmd = require('dmd');
const jsdoc2md = require('jsdoc-to-markdown');
const jsdocData = jsdoc2md.getTemplateDataSync({ files: 'your-file.js' });
const helpers = {
uppercase: function (str) { return str.toUpperCase(); }
};
const output = dmd(jsdocData, { helper: helpers });
console.log(output);
jsdoc-to-markdown is a tool that generates markdown documentation from JSDoc comments. It is often used in conjunction with dmd to provide the data that dmd formats into markdown. Unlike dmd, jsdoc-to-markdown focuses on extracting and converting JSDoc comments into a format that can be further processed.
documentation is a documentation generation tool that supports multiple output formats, including HTML and markdown. It provides a more comprehensive solution compared to dmd, with built-in support for various output formats and more advanced features like linting and validation of JSDoc comments.
docco is a quick-and-dirty documentation generator that produces HTML documentation with source code and comments side-by-side. While it does not generate markdown like dmd, it is useful for creating readable documentation that closely follows the source code.
preview release, not much documentation.. new version and docs coming soon
#dmd dmd (Document with Markdown) exposes a Transform stream class which, when fed jsdoc-parse data, outputs documentation in markdown format. The data at input is fed into the main template and rendered by handlebars.
##Customise No doubt there is something about the default template you don't like, there normally is. Use these block helpers to do it yourself.
Helper name | Description |
---|
##Default Template
###Partials
Partial name | Description |
---|---|
main.hbs | The template that is rendered, taking the doclet json as input. The jsdoc2md --json option will display that data. |
main-index.hbs | The main index. Will only be display if at least 2 "parent" identifiers are documented. |
##Synopsis
examples/input/doclet.json
:
[
{
"name": "fatUse",
"kind": "member",
"description": "I am a global variable",
"scope": "global"
}
]
$ cat examples/input/doclet.json | dmd
#Global
##fatUse
I am a global variable
##Usage ###As a library Install:
$ npm install dmd --save
Example:
var dmd = require("dmd");
process.stdin.pipe(dmd()).pipe(process.stdout);
###At the command line
Install the dmd
tool globally:
$ npm install -g dmd
Example:
$ cat examples/doclet.json | dmd
##Plugins
#API Reference
###dmd(options) ⇒ stream
⏏
Transforms doclet data into markdown documentation
Param | Type | Description |
---|---|---|
options | object | The render options |
[options.template] | string | A handlebars template to insert your documentation into. |
[options.heading-depth] | number | the heading depth to begin the docs from (e.g. 2 starts from a markdown heading of ## ). Defaults to 2 . |
[options.partial] | string | Array.<string> | overrides |
[options.helper] | string | Array.<string> | overrides |
[options.plugin] | string | Array.<string> | packages containing overrides |
Returns: stream
- A transform stream - pipe doclet data in to receive rendered markdown.
documented by jsdoc-to-markdown
© 2015 Lloyd Brookes 75pound@gmail.com
FAQs
The default output template for jsdoc-to-markdown
The npm package dmd receives a total of 172,059 weekly downloads. As such, dmd popularity was classified as popular.
We found that dmd demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.