@datalackey/autogen-markdown-doc
v1.1.13
Published
Combined documentation automation: update-markdown-toc + nx-graph-to-mermaid
Readme
@datalackey/autogen-markdown-doc
A simplified entry point, intentionally opinionated, repository-wide documentation auto-generator and consistency checker.
NOTE: this plugin not currently stable as of 3/2024. getting there...
Overview
This package is an uber-bundle comprising the following npm packages:
each of which can be used to independently, or via the following simplified pre-configured entrypoints which apply 'sensible defaults' to the configuration options of the bundled plugins:
update
OR:
check- verify that the latest checked-in documentation matches the configuration source, i.e.:
- TOC entry links are complete and link validly to corresponding sections of their Markdown documents
- up-to-date'ness of all Markdown documents with a Mermaid diagram injected into position marked via start and end tags.
- verify that the latest checked-in documentation matches the configuration source, i.e.:
In a nutshell:
updatereconciles repo to canonical documentation state (writes)checkverifies repo's auto generated documentation is already canonical (no writes; exits non-zero on drift)
Installation
npm i -D @datalackey/autogen-markdown-docUsage
Update Mode
update mutates files to bring the repository into the expected documentation state.
Behavior:
- Recursively scans the repository
- Uses default exclusion list:
node_modules(only)
- Processes all Markdown (
.md) files - Updates Table of Contents content (via
@datalackey/update-markdown-toc) - Generates Mermaid graph output (via
@datalackey/nx-graph-to-mermaid) - Updates Mermaid blocks only where existing Mermaid injection markers are present
- Writes changes to disk
Run via:
npx autogen-markdown-doc updateCheck Mode (CI Drift Detection)
check performs a full repository validation pass without mutating any files.
Behavior:
- Recursively scans the repository
- Uses default exclusion list:
node_modules(only)
- Processes all Markdown (
.md) files - Validates Table of Contents drift
- Validates Mermaid drift for all existing Mermaid injection markers
- Reports:
- list of files out of date
- type of drift (TOC / Mermaid / both)
- Exits with status code
1if any drift is detected - Exits with status code
0if no drift is detected
Run via:
npx autogen-markdown-doc checkDeterminism Gurantees
The intended invariant:
- Running
updatetwice produces no changes on the second run. checkpasses immediately afterupdate.
Conceptually:
check(repo) === no-op(update(repo))When to Use the Underlying Tools Directly
Use the underlying packages if you need:
- Custom exclusion lists beyond
node_modules - File- or directory-specific operations
- Mermaid-only or TOC-only workflows
- Advanced or non-default configuration
Built With
@datalackey/update-markdown-toc— Markdown TOC generation@datalackey/nx-graph-to-mermaid— Mermaid diagram generation
For the full workspace tech stack see: TECH-STACK.md
Packaging, Publishing, and Inter-relationship with Other Plugins
This package is one component of a small ecosystem of JavaScript tooling plugins maintained as individual npm packages in this repository. The versioning and release of these packages is governed by a coordinated release policy, and the packages adhere to common design and architectural principles policies that are more completely described here.
License
MIT
