An opinionated documentation file manager API.
The goals of md-doc are:
- Write documentation with markdown.
- Support external tools to interact and rely on md-docs.
Documentation can be organised in a Project by the following scopes:
- Project
- Directory
- File
Markdown files that are managed by md-docs are stored at the root of project in .mddocs/.
'use strict';
let markdownDoc = require('md-doc');
let projectRootPath = './unicorns/';
// Starts a watcher for changes in a project
markdownDoc(projectRootPath, (mdd) => {
console.log('Ready to do stuff!')
/* Add doc files to the project */
// Doc will be scoped to the project (alias for addDirDoc to project root dir)
mdd.addProjectDoc('Project Setup', '# Title!\nContent', (docPath) => console.log(docPath));
// Doc will be scoped to a directory within the project root
mdd.addDirDoc('Project Setup', 'rainbows/', '# Title!\nContent', (docPath) => console.log(docPath));
// Doc will be scoped to a file within the project root
mdd.addFileDoc('Project Setup', 'rainbows/kittens.js', '# Title..\nContent..', (docPath) => console.log(docPath));
/* Handle changes in md-doc */
mdd.on('ready', () => console.log('all the doc files are now being watched :)'));
mdd.on('added', (filePath) => console.log(filepath));
mdd.on('changed', (filePath) => console.log(filepath));
mdd.on('deleted', (filePath) => console.log(filepath));
mdd.on('end', () => console.log('all the doc files are not being watched :('));
});$ npm install --save md-docMIT © BKVFoundry
- Lochlan Bunn (author)