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 = ;const docOptions =// Context will bring in package.jsoncontext: Pkgdirname: __dirnameroutes:// Data files to bring into contextdataPaths: './data'// Incase a user wants to handle his own viewsviewPath: 'views'// Static assets. Can set via command lineassetPaths: '../../my/other/app'// Path to documentationdocsPath: argspath + '/**/*.{md,html}'// Entry filehomeFile: './README.md'// Open in browser or notopen: true// Watch for file changeswatch: true// Set the portport: argsport || 3210;// Returns a Hapi serverconst server = ;
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