docs

extractDocs collects documentation from markdown files and /*# comment blocks in source code into one corpus, the docs.json that the doc-browser and the static site render. tosijs-ui/site runs it for you; call it yourself only to build a corpus outside that pipeline. It reads files, so it runs under bun or node.

Usage

import { extractDocs } from 'tosijs-ui/site'

const docs = extractDocs({
  paths: ['src', 'README.md'],
  output: 'public/docs.json',
})

extractDocs(options)

Returns an array of Doc objects: text (the markdown), title, filename, path, and whatever metadata the doc declares (pin, order, parent, layout, description, …).

What is collected

Metadata blocks (<!--{ … }--> in markdown, /*{ … }*‎/ in code), nav order, sections and which code fences run live are described under Doc format.