# @travetto/doc

> Documentation support for the Travetto framework

Latest version **8.0.2** (published 2026-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @travetto/doc
pnpm add @travetto/doc
yarn add @travetto/doc
bun add @travetto/doc
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 8.0.2 |
| Published | 2026-09-12 |
| First published | 2021-04-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 76.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Travetto Framework |
| Maintainers | arcsine |
| Keywords | docs, travetto, typescript |

## Links

- npm: https://www.npmjs.com/package/@travetto/doc
- Repository: https://github.com/travetto/travetto
- Homepage: https://travetto.io
- Issues: https://github.com/travetto/travetto/issues
- npm.io page: https://npm.io/package/@travetto/doc

## Dependencies (5)

- [prismjs](https://npm.io/package/prismjs.md) ^1.30.0
- [markdown-it](https://npm.io/package/markdown-it.md) ^15.0.2
- [@types/prismjs](https://npm.io/package/@types/prismjs.md) ^1.26.6
- [@travetto/runtime](https://npm.io/package/@travetto/runtime.md) ^8.0.1
- [@types/markdown-it](https://npm.io/package/@types/markdown-it.md) ^14.2.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 8.0.2 (latest) — 2026-09-12
- 8.0.0-alpha.24 (alpha) — 2026-08-24
- 7.0.0-rc.5 (rc) — 2025-12-30
- 8.0.1 — 2026-09-05
- 8.0.0 — 2026-09-05
- 8.0.0-alpha.23 — 2026-08-24
- 8.0.0-alpha.22 — 2026-07-25
- 8.0.0-alpha.21 — 2026-07-25
- 8.0.0-alpha.20 — 2026-07-18
- 8.0.0-alpha.19 — 2026-07-12
- 8.0.0-alpha.18 — 2026-06-14
- 8.0.0-alpha.17 — 2026-06-13
- 8.0.0-alpha.16 — 2026-06-13
- 8.0.0-alpha.14 — 2026-04-17
- 8.0.0-alpha.13 — 2026-04-15
- … 179 more at https://npm.io/package/@travetto/doc/versions

## README

<!-- This file was generated by @travetto/doc and should not be modified directly -->
<!-- Please modify https://github.com/travetto/travetto/tree/main/module/doc/DOC.tsx and execute "npx trv doc" to rebuild -->
# Documentation

## Documentation support for the Travetto framework

**Install: @travetto/doc**
```bash
npm install @travetto/doc

# or

yarn add @travetto/doc
```

This module provides the ability to generate documentation in [HTML](https://en.wikipedia.org/wiki/HTML) and/or [Markdown](https://en.wikipedia.org/wiki/Markdown). The module relies on integrating with the source of the project, and providing a fully referenced code-base. This allows for automatic updates when code is changed and/or refactored.

**Code: Document Sample**
```typescript
/** @jsxImportSource @travetto/doc/support */
import { c } from '@travetto/doc';

export const text = (
  <>
    <c.StdHeader />
    Sample documentation for fictional module. This module fictitiously relies upon <c.Module name="Cache" /> functionality.
    <ol>
      <li>First</li>
      <li>Second</li>
      <li>
        <c.Path name="Special" />
      </li>
    </ol>
    <c.Section title="Content">
      <c.Code title="Document Sample" src="./src/test.ts" />

      <c.SubSection title="Output">
        <c.Execution title="Run program" cmd="trv" />
      </c.SubSection>
    </c.Section>
  </>
);
```

**Code: Document Context**
```typescript
export interface DocumentShape {
  text: JSXElement | JSXElement[] | (() => Promise<JSXElement | JSXElement[]>);
  wrap?: Wrapper;
}
```

As you can see, you need to export a field named `text` as the body of the help text. The `text` field can be either a direct invocation or an async function that returns the expected document output.

**Note**: By design all the node types provided are synchronous in nature. This is intentionally, specifically with respect to invoking commands and ensuring singular operation.

## Node Types

   *  `Anchor` - In page anchor reference
   *  `Class` - Class reference
   *  `CliHelpDescription` - Standardized CLI command help description
   *  `CliHelpExecution` - Standardized CLI command help execution
   *  `CliHelpSection` - Standardized CLI command help section
   *  `Code` - Code sample
   *  `CodeLink` - Code link with regexp for detecting line
   *  `Command` - Command invocation
   *  `Config` - Configuration block
   *  `Execution` - Run a command, and include the output as part of the document
   *  `Field` - Field reference
   *  `File` - File reference
   *  `Header` - Basic module header
   *  `Image` - Image reference
   *  `Input` - Input text
   *  `Install` - Installing a package or a program
   *  `Library` - Library reference
   *  `Method` - Method declaration
   *  `Module` - Node Module Reference
   *  `Note` - A note
   *  `Path` - Path reference
   *  `Ref` - File reference
   *  `Section` - Primary section
   *  `StdHeader` - Standard module header
   *  `SubSection` - Sub-section
   *  `SubSubSection` - Sub-sub-section
   *  `Terminal` - Terminal output

## Libraries
Some of the more common libraries are provided as the `d.library` method. The purpose of this is to have consistent references to common utilities to help keep external linking simple.

## Modules
You can also link to other [Travetto](https://travetto.dev) based modules as needed. The `d.module` object relies on what is already imported into your project, and reference the package.json of the related module. If the module is not installed, doc generation will fail.

## CLI - doc
Generate documentation outputs from a module `DOC.tsx` entry file.

**Terminal: Help for doc**
```bash
$ trv doc --help

Usage: doc [options]

Description:
  Generate documentation outputs from a module `DOC.tsx` entry file.

  Supports multiple output formats/targets and optional watch mode for
  iterative documentation authoring.

Options:
  -i, --input <string>    Input File (default: "DOC.tsx")
  -o, --outputs <string>  Outputs (default: ["README.md","DOC.html"])
  -w, --watch             Watch? (default: false)
  --help                  display help for command
```

By default, running the command will output the [Markdown](https://en.wikipedia.org/wiki/Markdown) content directly to the terminal.

**Terminal: Sample CLI Output**
```bash
$ trv doc -o html

<!-- This file was generated by @travetto/doc and should not be modified directly -->
<!-- Please modify ./doc-exec/DOC.tsx and execute "npx trv doc" to rebuild -->
<h1>@travetto-doc/doc</h1>

  <figure class="install">
    <figcaption class="install">Install @travetto-doc/doc
    
    </figcaption>
    <pre><code class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> @travetto-doc/doc

<span class="token comment"># or</span>

<span class="token function">yarn</span> <span class="token function">add</span> @travetto-doc/doc</code></pre>
  </figure>

Sample documentation for fictional module. This module fictitiously relies upon <a class="module-link" href="https://github.com/travetto/travetto/tree/main/module/cache" title="Caching functionality with decorators for declarative use.">Caching</a> functionality.
<ol> <li>First</li>
<li>Second</li>
<li><code class="item path">Special</code></li>
</ol>

<h2 id="content">Content</h2>

  <figure class="code">
    <figcaption class="code">Document Sample
<cite><a target="_blank" href="./doc-exec/src/test.ts">Source</a></cite>

</figcaption>
    <pre><code class="language-typescript"><span class="token keyword">class</span> <span class="token class-name">TestFile</span> <span class="token punctuation">{{'{'}}</span>
  <span class="token keyword">static</span> <span class="token function">method</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator">:</span> <span class="token keyword">void</span> <span class="token punctuation">{{'{'}}</span><span class="token punctuation">{{'}'}}</span>
<span class="token punctuation">{{'}'}}</span></code></pre>
  </figure>

<h3 id="output">Output</h3>

  <figure class="terminal">
    <figcaption class="terminal">Run program

</figcaption>
    <pre><code class="language-bash">$ trv

Usage:  <span class="token punctuation">[</span>options<span class="token punctuation">]</span> <span class="token punctuation">[</span>command<span class="token punctuation">]</span>

Commands:
  doc        Generate documentation outputs from a module <span class="token variable"><span class="token variable">`</span>DOC.tsx<span class="token variable">`</span></span> entry file.
  <span class="token function">service</span>    Manage development services <span class="token punctuation">(</span>start/stop/restart/status<span class="token punctuation">)</span> across the workspace.</code></pre>
  </figure>
```

---
_Source: https://npm.io/package/@travetto/doc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
