the-documentator

0.1.3 • Public • Published

{{ name }}

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
  • Allow overriding handlebars config options
    • Create init subprogram that copies handlebars config and files to current working directory

Readme

Keywords

none

Package Sidebar

Install

npm i the-documentator

Weekly Downloads

0

Version

0.1.3

License

ISC

Unpacked Size

80.6 kB

Total Files

23

Last publish

Collaborators

  • damusix