New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

docs-draft

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docs-draft

Create a draft of a README.md

latest
Source
npmnpm
Version
1.0.8
Version published
Maintainers
1
Created
Source

docs-draft

NPM version Downloads Dependency Status

Are you tired to write every time the documentation of your programs??

This module can simplify this, in fact docs-draft build a structure of a documentation. You have to create only a draftFile.js and choose what you want from a simple paragraph to a table

Table of Contents

Installation

First globally:

$ npm i -g docs-draft

Now in your project:

$ npm i docs-draft

How to use it

You have to create a draftFile.js in your program folder.

example of draftFile.js:

const docsDraft = require('docs-draft');

docsDraft({ create: { projectName: 'docs-draft' } });

docsDraft({
  addParagraph: {
    title: '## Example',
    paragraph: 'this README is created with docs-draft'
  }
});

You can invoke one time the function and execute many task in one time.

There is an example here

When you finish with the draftFile you have to run this command on your cli in the folder where the draftFile is:

$ draft

Good, now you have your documentation in markdown.

Tasks

Create

projectName = string

options = object

options = {
  npm: true,
  dependencies: {
    username: 'example',
    repository: 'example'
  }
    ...
}

Create a README.md and if it already exists, the contents of the file is replaced.

In the draftFile.js

const docsDraft = require('docs-draft');

docsDraft({
  create: {
    projectName: 'docs-draft',
    options: {
      npm: true,
      dependencies: {
        username: 'example',
        repository: 'example'
      }
    }
  }
});

This method create in the current directory a README.md file

AddParagraph

title: string

paragraph: string

options = {
  title: 'string',
  pargraph: 'string'
}

The title is a string which have also # for sub paragraph

ex.

const docsDraft = require('docs-draft');

docsDraft({
  addParagraph: {
    title: '# Hello',
    paragraph: 'how are you?'
  }
});

docsDraft({
  addParagraph: {
      title: '## Hello',
      paragraph: 'how are you?'
    }
});

docsDraft({
  addParagraph: {
      title: '### Hello',
      paragraph: 'how are you?'
    }
});

TableOfContents

contents: array of string

options = {
  contents: [...]
}

ex.

const docsDraft = require('docs-draft');

docsDraft({
  tableOfContents: {
    contents: ['value1', 'value2']
  }
});

Table

columns: number, records: number

options = {
  colums: 10,
  records: 10
}

ATTENTION: THE FIRST RECORD IS FOR HEADERS

ex.

const docsDraft = require('docs-draft');

docsDraft({
  table: {
    columns: 23,
    records: 12
  }
})

Example

here an example of draftFile.js

Author

-Nicola Guerra

License

MIT

Keywords

md

FAQs

Package last updated on 02 Mar 2018

Did you know?

Socket

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.

Install

Related posts