Skip to content

docs: add module API reference #23

Description

@adrianbrowning

packages/mdcode/README.md documents the CLI only. The package also ships a programmatic API via zshy exports (.src/index.ts, ./clisrc/cli.ts), which is undocumented.

Worth covering:

  • parse({ source, filter }) / walk() — block shape, position offsets, metadata extraction.
  • region.read(source, name, lang?), region.outline(source), region.replace(source, name, newContent, lang?) — note the optional lang param, which selects the comment style (// vs # vs <!--); omitting it falls back to // and /* */ only.
  • region.getCommentStyle(lang).
  • Command functions and their option types: extract (incl. force), update, list, run, dump.
  • defineTransform() — already shown in CLAUDE.md but not in the README.

Prompted by #21: replace() gained an optional lang argument with no place to document it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions