Skip to content

Annotations Context

Submodule of Annotations. Assembles annotation data into a structured PHP array payload and ships two renderers (markdown, HTML render arrays) plus an admin preview UI.

The payload is the stable API surface: format-agnostic, permission-aware, and extensible via alter hook. annotations_tool consumes it to expose annotations to function-calling AI agents; the preview page and markdown export are human-readable views of the same data.


Requirements

  • annotations (core Annotations module)

Installation

ddev drush en annotations_context

What it provides

  • Context preview at /admin/config/annotations/context — live HTML preview of assembled context, filterable by role, target, reference depth, and field metadata.
  • Role simulation — preview context as any Drupal role sees it (respects consume {type} annotations permissions).
  • Markdown export at /admin/config/annotations/context/export — downloads context as a .md file.
  • Drush export via annotations_export's drush ann:ex --format=markdown — assembles context and prints it as markdown.

Permissions

Permission Notes
view annotations context Access to the preview page and markdown export. restrict access: true — grants role simulation (preview context as any role), so assign deliberately (e.g. to project managers reviewing documentation).

administer annotations also grants access (OR logic in routing).


See DEVELOPING.md for the ContextAssembler PHP API, renderer details, entity-reference traversal, the hook_annotations_context_alter extension hook, and Drush command options.