the-documentator
v0.1.3
Published
A file-system based documentation library with lots of features.
Downloads
4
Readme
DOCUMENTATOR
GET TO DOCUMENTATING!
NAU!
Features
- Front matter
- Handlebars
- Markdown
- Anchor links
- Attributes
- Emojis
- Tables
- Font Awesome
- Animate.css
- Tailwindcss
- JS Beautify
Get Started
npm install -g the-documentator
cd /path/to/my/files
the-documentator . --data mydata/books --assets myassets/css
See command line options
the-documentator --help
Or instantiate it into a file:
const Docs = require('the-documentator');
const docOptions = {
// Context will bring in package.json
context: Pkg,
dirname: __dirname,
routes: {
// Data files to bring into context
dataPaths: ['./data'],
// Incase a user wants to handle his own views
viewPath: 'views',
// Static assets. Can set via command line
assetPaths: ['../../my/other/app'],
// Path to documentation
docsPath: args.path + '/**/*.{md,html}',
// Entry file
homeFile: './README.md'
},
// Open in browser or not
open: true,
// Watch for file changes
watch: true,
// Set the port
port: args.port || 3210
};
// Returns a Hapi server
const server = Docs(docOptions);
And start creating your documentation!
How it works
The app brings in html
and md
files and processes them using markdown-it. First, it parses files through handlebars
, then it parses the markdown, the parses it again through handlebars
via hapi/vision
. In both instances, both package.json
and anything you pass in docOptions.routes.dataPaths
will be available as a variable in handlebars
.
Assets
Any directories you pass into docOptions.routes.assetPaths
will be used to call from the filesystem via /assets/{*path}
url. The node_modules
folder for the documentator
package is avaiable in path, so you can access its npm packages directly.
TODO
- Tests
- Complete CLI
- Create
watch
functionality- Hook up frontend websocket using
hapi/nes
and trigger reloads when watching
- Hook up frontend websocket using
- Allow overriding
handlebars
config options- Create
init
subprogram that copieshandlebars
config and files to current working directory
- Create