0.1.1 • Published 4 years ago

zendocs v0.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

ZenDocs

Discord Code Climate Coverage npm Version npm License

Please note that ZenDocs is still in a very early phase, so features might be broken or missing!

ZenDocs is a simple HTML documentation generator. It takes Markdown files and translates them into HTML files. It has a built-in live web server, so you can preview your changes while you're editing the documentation and it has support for custom HTML templates.

npm install -g zendocs

Getting started

To initialize a directory, simply type zendocs init. A new file called zendocs.json will be created. In it, you'll find the following configuration options:

pages

This is an array of all your Markdown files you want to include in your documentation. Example:

"pages": [
    "file.md",
    "anotherfile.md"
]

outputDir

The directory where the HTML docs will be saved. Example:

"outputDir": "html/"

Don't forget the trailing slash!

outputExt

Every file's extension (usually .html):

"outputExt": ".html"

Don't forget the dot!

encoding

Your files' encoding (usually utf-8):

"encoding": "utf-8"

refreshInterval

How many milliseconds will be between every file refresh (if you type zendocs build or zendocs serve, all your Markdown files will be watched for changes):

"refreshInterval": 500

useTemplate

Whether or not a HTML template will be used. Example:

"useTemplate": true

You will have to set templateFile to a valid path if you set this to true!

templateFile

The path of your HTML template file (needs to be enabled with useTemplate):

"templateFile": "template/template.html"

Managing pages with the CLI

Adding a new page

You can add new pages by typing zendocs page add <filename.md>. Don't forget to restart your build/serve processes after!

Removing a page

Type zendocs page remove <filename.md> to immediately remove a page. Don't forget to restart your build/serve processes after!

Templating

You'll need to enable templating first by changing useTemplate in zendocs.json before you can use it!

Just place an HTML file at the path specified in zendocs.json (templateFile) and add the following placeholders to it:

{{content}}

The parsed content of your Markdown files.

{{links}}

HTML links (<a>) to all the documentation files.

Example template

<!DOCTYPE html>
<html lang="en">
<head>
<title>Documentation</title>
<meta charset="utf-8">
<style>
html,
body {
    font-family: sans-serif;
}
</style>
</head>
<body>
<h1>My documentation</h1>
<nav>{{links}}</nav>
<hr>
{{content}}
</body>
</html>

Note: You can place all your assets (CSS, JS, ...) in the output directory to include them in your template or documents!

0.1.1

4 years ago

0.1.0

4 years ago