npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

md-docs

v1.2.1

Published

The documentation site generator

Downloads

539

Readme

md-docs Build Status

Markdown docs generator

Installation

md-docs can be installed both globally and locally.

npm install md-docs -g

Docs structure

The documentation is a collection of books. Each book has a unique title and contains several chapters. Each chapter should be written in a separate markdown file.

Each markdown file should start with a yaml header. Provide a name of a book to which the markdown file belongs to and a name of a chapter.

---
book: Installation procedures
chapter: Configuration
---

Markdown files that don't have the book and the chapter properties in the header are not included in the documentation.

Chapter yaml header options

  • book - (type: String, required) - A name of a book to which the chapter belongs to.

  • chapter - (type: String, required) - A name of the chapter.

  • permalink - (type: String, optional) - Custom, friendly url for the chapter. By default the url is generated from the name of the book and chapter.

  • default - (type: Boolean, optional) - When set to true, the chapter will be presented as first after entering the site.

  • order - (type: String, optional) - This field is used to sort chapters in a book.

Usage

md-docs [--help] [--src SRC1[,SRC2]] [--port PORT] [--base-href HREF] [--theme THEME] 
        [--ignored REGEXP] [--list-themes] [--init-theme [PARENT_THEME]] [--debug] [--watch]

optional arguments:
    --help                  Show this help message and exit.
    --src SRC1[,SRC2]       Glob patterns pointing to source markdown files
                            that should be included in generated docs. Defaults: **/*.md
    --port PORT             Port that will be used to serve the documentation 
                            on the web. Defaults: 8000
    --base-href HREF        Base URL prepended to the documentation paths
    --theme THEME           An embedded theme name or a path to a custom theme.
                            Defaults: default
    --watch                 Watches markdown files for changes.
    --ignore REGEXP         Defines files/paths to be ignored when watching. 
                            The whole relative or absolute path is tested, not just filename. 
                            Defaults: /([\/\\]\.|node_modules)/
    --list-themes           Lists all embedded themes.
    --init-theme [PARENT_THEME]
                            Initializes a new theme in a current directory. 
                            The new theme may derive content from any embedded
                            theme. Defaults: 'default'.
    --debug                 More verbosed output.

Example

Providing that you have the following structure of your docs:

example
├── deployment
│   ├── config.md
│   ├── installation.md
│   ├── os.md
│   └── test.md
└── installation
    ├── faq.md
    ├── intro.md
    ├── requirements.ms
    └── steps.md

Running documentation on local port 8001

$ cd example
$ md-docs --port 8001
Writing books.json
Using docs theme: default
Docs server listening on port 8001

List all availables themes

$ cd example
$ md-docs --list-themes
dark (parent: default)
default

Creating a custom theme which derives from 'dark'

$ cd example
$ mkdir my_theme
$ cd my_theme
$ md-docs --init-theme dark
Initializing theme using parents: dark,default
$ cd ..
$ md-docs --port 8001 --theme my_theme
Writing books.json
Using docs theme: my_theme
Docs server listening on port 8001

Getting started with code

Install md-docs in your project.

npm install md-docs --save

To begin with a default configuration, provide only paths to source markdown files:

var docs = require('md-docs');
docs.start('docs/**/*.md');

Public API

docs.start(src, [options])

Runs docs generated from src markdown files.

Example with all default options:

docs.start(['**/*.md'], {
    port: 8000,
    theme: 'default',
    watch: false,
    ignored: /([\/\\]\.|node_modules)/,
    docsDestDir: '/var/temp/asqqwe', // default value depends on the os 
    debug: false
});
  • src - (type: Array|String, defaults: ['\*\*/\*.md']) - Glob patterns pointing to source markdown files that should be included in generated docs.

  • options.port - (type: Integer, default: 8000) - A docs server port number.

  • options.theme - (type: String, default: 'default') - An embedded theme name or a path to a custom theme. To list all available embedded themes use md-docs --list-themes command.

  • options.watch - (type: Boolean, default: false) - Regenerates the documentaion where markdown files are added, changed or deleted.

  • options.ignored - (type: Array|String|RegExp, default: /([\/\\]\.|node_modules)/) - This is anymatch-compatible pattern. Defines files/paths that has to be ignored. The whole relative or absolute path is tested, not just filename.

  • options.debug - (type: Boolean, default: false) - Verbosed output.

  • options.docsDestDir - (type: 'String', default: os specific) - An intermediate directory to which the html content is generated from all found markdown files. If the docsDestDir option is not specified then html content is generaded to a os-specific temp directory and served from there. The temporary directory is cleared after md-docs process is terminated.

  • options.baseHref - (type: 'String', default: '/') - Base URL prepended to the documentation paths.

Using with gulp

The md-docs server can be started using gulp task.

var gulp = require('gulp'),
    docs = require('md-docs');

gulp.task('default', function() {
    docs.start('./**/*.md');
});

Markdown

Links

Relative links to other chapters in markedown documents are allowed. Important: realtive URL must not have a forward slash at the begining.

[Application / Intro](application/intro)

Changelog

See the CHANGELOG.md file to get more info about release changes.