1.38.7 • Published 4 years ago

documentary v1.38.7

Weekly downloads
6
License
AGPL-3.0
Repository
gitlab
Last release
4 years ago

Documentary

npm version

Documentary is a command-line tool to manage documentation of Node.JS packages of any size. Due to the fact that there is usually a lot of manual labour involved in creating and keeping up-to-date a README document, such as copying examples and output they produce, there is a need for software that can help automate the process and focus on what is really important, i.e., documenting features. Documentary serves as a pre-processor of documentation and enhances every area of the task of making available high-quality docs for Node.JS (and other languages) packages for fellow developers.

yarn add -D documentary
npm i documentary --save-dev

For example, these are some pieces of documentation infrastructure made available by Documentary:

<!-- Tables Of Contents -->
%TOC%

<!-- Examples with paths renaming -->
%EXAMPLE: example/index.js, ../src => documentary%

<!-- Forks, native with import/export/jsx -->
<fork stderr nocache env="HELLO=WORLD">
  example/index.js
</fork>

<!-- Typedefs with linking -->
<typedef narrow flatten>
  types/index.xml
</typedef>

<!-- Methods with custom heading designs -->
```## runSoftware
[
  ["program", "string"],
  ["config=", "Object"]
]
```

<!-- Section Breaks -->
%~ width="25"%

<!-- JSX Components -->
<my-component package="documentary">
  Checkout https://readme.page
</my-component>

All of these features come with just 3 transient dependencies in your node_modules:

../documentary-test/node_modules
├── alamode
├── documentary
├── preact
└── typal

Table Of Contents

Wiki

Each feature of Documentary is described on its relevant Wiki page.

  • ⭐️Key Features: A quick overview of the solutions provided by Documentary for developers to make writing documentation a breeze.
  • 📖Tables Of Content: Creating a navigation menu for the README page.
  • ⚜️Section Breaks: Placing visual separators of sections.
  • 📐JSON Tables: Writing JSON array data to be converted into a Markdown table.
  • 📜Embed Examples: Decoupling examples from documentation by maintaining separate runnable example file.
  • 🍴Forks (Embed Output): Executing examples to show their output, and validating that program works correctly.
  • 🎩Method Titles: Documenting methods in a standard way, and provide your own designs.
  • 🎇JSX Components: Implementing custom system-wide and project-scoped components.
  • 🤖Macros: Constructing patterns to be reused in formation of READMEs.
  • ☀️Typedefs: Display @typedef information in README files by maintaining types externally to JS source.
  • 🎼Type (Deprecated): An older version of typedefs which works as a macro for types.
  • 🥠Gif Detail: Hiding images inside of the <details> block.
  • 🖱API: Using Documentary's features from other packages.

Installation & Usage

The doc client is available after installation. It can be used in a doc script of package.json, as follows:

{
  "scripts": {
    "doc": "doc documentary -o README.md"
  }
}

The first argument, documentary is a path to a directory containing source documentation files, or a path to a single file to be processed, e.g., README-source.md.

Therefore, to produce an output README.md, the following command will be used:

yarn doc

When actively working on documentation, it is possible to use the watch mode with -w flag, or -p flag to also automatically push changes to a remote git repository, merging them into a single commit every time.

Misc

These are some essential feature of Documentary.

Comments Stripping

Since comments found in <!-- comment --> sections are not visible to users, they will be removed from the compiled output document.

File Splitting

Documentary can read a directory and put files together into a single README file. The files will be sorted in alphabetical order, and their content merged into a single stream. The index.md and footer.md are special in this respect, such that the index.md of a directory will always go first, and the footer.md will go last. To print in reverse order, for example when writing a blog and name files by their dates, the --reverse flag can be passed to the CLI.

Example structure used in this documentation:

documentary
├── 1-installation-and-usage
│   └── index.md
├── 2-features
│   ├── 4-comment-stripping.md
│   ├── 5-file-splitting.md
│   ├── 6-rules.md
│   └── index.md
├── 3-cli.md
├── footer.md
└── index.md

Replacement Rules

There are some other built-in rules for replacements which are listed in this table.

RuleDescription
%NPM: package-name%Adds an NPM badge, e.g., [![npm version] (https://badge.fury.io/js/documentary.svg)] (https://npmjs.org/package/documentary)
%TREE directory ...args%Executes the tree command with given arguments. If tree is not installed, warns and does not replace the match.

CLI

The program is used from the CLI (or package.json script).

doc [source] [-o output] [-trwcn] [-p "commit message"] [-h1] [-eg] [-vh]

The arguments it accepts are:

When NODE_DEBUG=doc is set (or -d flag is passed), the program will print processing information, e.g.,

DOC 80734: stripping comment
DOC 80734: could not parse the table

This is quite essential to understanding the status of documentation processing, and will be enabled by default in the next version.

Markdown Files

Only the following extensions are processed: markdown, md, html, htm. Anything else is ignored. This is to allow to place examples in the documentary folder. To process all files, set the ONLY_DOC=false variable.

Hidden Files

Hidden files are ignored by default. This can be changed by setting the DOCUMENTARY_IGNORE_HIDDEN=false env variable.

♫ PRO ♪ Underlined

Titles

Titles written as blocks and underlined with any number of either === (for H1) and --- (for H2), will be also displayed in the table of contents. However, the actual title will appear on a single line.

♫PRO
♪Underlined
♯ `Titles`
---

As seen in the Markdown Cheatsheet.

Glossary

  • Online Documentation: documentation which is accessible online, such as on a GitHub website, or a language reference, e.g., Node.js Documentation.
  • Editor Documentation: hints available to the users of an IDE, or an editor, in form of suggestions and descriptive hints on hover over variables' names.

Copyright

Section breaks from FoglihtenDeH0 font.

1.38.7

4 years ago

1.38.6

4 years ago

1.38.5

4 years ago

1.38.2

4 years ago

1.38.3

4 years ago

1.38.4

4 years ago

1.38.1

4 years ago

1.38.0

4 years ago

1.37.1

4 years ago

1.37.0

4 years ago

1.36.1

4 years ago

1.36.0

4 years ago

1.35.13

4 years ago

1.35.12

4 years ago

1.35.11

4 years ago

1.35.10

4 years ago

1.35.9

4 years ago

1.35.8

4 years ago

1.35.7

4 years ago

1.35.5

4 years ago

1.35.6

4 years ago

1.35.4

4 years ago

1.35.3

4 years ago

1.35.2

4 years ago

1.35.1

4 years ago

1.35.0

4 years ago

1.34.10

4 years ago

1.34.9

4 years ago

1.34.11

4 years ago

1.34.7

4 years ago

1.34.8

4 years ago

1.34.6

4 years ago

1.34.5

4 years ago

1.34.3

4 years ago

1.34.4

4 years ago

1.34.2

4 years ago

1.34.1

5 years ago

1.34.0

5 years ago

1.33.3

5 years ago

1.33.2

5 years ago

1.33.1

5 years ago

1.33.0

5 years ago

1.32.2

5 years ago

1.32.1

5 years ago

1.32.0

5 years ago

1.31.1

5 years ago

1.31.0

5 years ago

1.30.3

5 years ago

1.30.2

5 years ago

1.30.1

5 years ago

1.30.0

5 years ago

1.29.0

5 years ago

1.28.2

5 years ago

1.28.1

5 years ago

1.28.0

5 years ago

1.27.7

5 years ago

1.27.6

5 years ago

1.27.5

5 years ago

1.27.4

5 years ago

1.27.3

5 years ago

1.27.2

5 years ago

1.27.1

5 years ago

1.27.0

5 years ago

1.26.5

5 years ago

1.26.4

5 years ago

1.26.3

5 years ago

1.26.2

5 years ago

1.26.1

5 years ago

1.26.0

5 years ago

1.25.0

5 years ago

1.24.1

5 years ago

1.24.0

5 years ago

1.23.4

5 years ago

1.23.3

5 years ago

1.23.2

5 years ago

1.23.1

5 years ago

1.23.0

5 years ago

1.22.0

5 years ago

1.21.5

5 years ago

1.21.4

5 years ago

1.21.3

5 years ago

1.21.2

5 years ago

1.21.1

5 years ago

1.21.0

5 years ago

1.20.1

6 years ago

1.20.0

6 years ago

1.19.0

6 years ago

1.18.2

6 years ago

1.18.1

6 years ago

1.18.0

6 years ago

1.17.0

6 years ago

1.16.1

6 years ago

1.16.1-beta4

6 years ago

1.16.1-beta3

6 years ago

1.16.1-beta2

6 years ago

1.16.1-beta1

6 years ago

1.16.0

6 years ago

1.15.2

6 years ago

1.15.1

6 years ago

1.15.0

6 years ago

1.14.0

6 years ago

1.13.0

6 years ago

1.12.0

6 years ago

1.11.0

6 years ago

1.10.0

6 years ago

1.9.0

6 years ago

1.8.2

6 years ago

1.8.1

6 years ago

1.8.0

6 years ago

1.7.0

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.0

6 years ago

1.4.2

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago