Install and quick start
This package installs the merlon CLI for use in your repo or CI. It works in any codebase, whatever its stack or layout, because Merlon Docs manages only your documentation shards and compile pipeline.
To install the Agent Skill instead, see Get started and the skill catalog (or Not the Agent Skill).
Requirements
Section titled “Requirements”- Node.js 20.19.0 or later.
Install
Section titled “Install”# Dev dependency (recommended)npm install -D @merlon-docs/merlon-docs-cli
# Or run without installingnpx @merlon-docs/merlon-docs-cli check --config merlon.config.json
# Global installnpm install -g @merlon-docs/merlon-docs-cliSeveral commands run peer tools that you install in your repository, such as markdownlint-cli2 for merlon lint and Vale for merlon prose. Optional linters lists the peer tools each command runs and how to install them.
Stability
Section titled “Stability”Before 1.0.0, CLI commands, flags, the merlon.config.json schema and compile output can change in any 0.x.y release, under the pre-1.0 policy.
Before upgrading, read the changelog and release notes of each Merlon Docs package you use. They hold the upgrade notes for earlier releases, which the feature catalog doesn’t repeat.
Quick start
Section titled “Quick start”-
Create
merlon.config.jsonin your docs root. Start with this minimal config for two guides,overviewandadmin-guide. SetconfigVersionto the version of@merlon-docs/merlon-docs-coreyou install; when it’s missing, loading the config fails and names the value to add. Minimal config says what each field does:{"configVersion": "1.0.0","compileOrder": ["overview", "admin-guide"],"guides": [{ "name": "overview" }, { "name": "admin-guide" }]}Once you install markdownlint-cli2 and
@merlon-docs/merlon-docs-presetswith the npm command in Optional linters, add alintkey that lints the shards with the shard preset. The whole file then reads:{"configVersion": "1.0.0","compileOrder": ["overview", "admin-guide"],"guides": [{ "name": "overview" }, { "name": "admin-guide" }],"lint": {"markdownlint": {"shardsConfig": "../node_modules/@merlon-docs/merlon-docs-presets/markdownlint-shards.markdownlint-cli2.jsonc"}}}This path works when the docs root is a direct child of the directory that holds
node_modules, and Optional linters says how Merlon Docs resolves it. When markdownlint-cli2 is missing,merlon checkskips the shard pass with an info line unless you pass--require-lint. When the preset file is missing, the pass fails. Optional linters also covers the compiled-output preset and Vale. -
Lay out shards under guide directories (each with
index.mdand chapter files). The sample guides in the Merlon Docs repository show a layout, and you can copy single keys from their config. -
Run:
Terminal window # When your shell is in the docs rootmerlon compile --config merlon.config.jsonmerlon check --config merlon.config.json --skip-valeFrom the repository root (typical npm scripts), pass both
--configand--docs-root:Terminal window merlon compile --config docs/merlon.config.json --docs-root docsmerlon check --config docs/merlon.config.json --docs-root docs --skip-vale--configvs--docs-rootsays what each flag resolves from, and Global options lists the options that every command accepts.--skip-valeleaves Vale out of the check. Without it,merlon checkruns Vale whenever it findsvale, and Vale stops with a runtime error when it can’t find a config. Drop the flag once you set up Vale as Optional linters describes. -
Add
docs:compileanddocs:checkscripts to your repo-rootpackage.json, as Repo-root npm scripts shows. The check script runsmerlon check --require-lint. Add--skip-valeto it until Vale is set up, then replace that flag with--require-vale. -
Run the same compile and check scripts in CI. The verification checklist lists what to confirm once they pass.
If your repository commits compiled outputs, such as a package README that is a publish output, add a CI step that runs
git diff --exit-codeaftermerlon compile. That step fails when a committed output differs from what its shards compile to.merlon checkwrites every output again before it checks them, so it passes on a stale one.
Verification checklist
Section titled “Verification checklist”After you set up a repository, confirm each item:
merlon compile: per-guide outputs under_build/(or explicitcompile.outputFiletargets); optional monolith whenoutputFileis setmerlon check --require-lint: passes the check gate with markdownlint-cli2 required for each configured markdownlint stagemerlon check --require-vale: when Vale is configured- Hook output: diagram tables inlined (
inlineInserts), code evidence blocks resolved (codeEvidence), cross-guide links rewritten to#slugtargets in compiled output (a link to a guide incompile.crossGuideLinks.ignoreGuideskeeps its shard.mdpath, except in the cases that its config section points to)