docs-draft
v1.0.8
Published
Create a draft of a README.md
Downloads
14
Maintainers
Readme
docs-draft
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
License
MIT