Files
distributor/docs/internal/transform.md

1.9 KiB

Transform

Purpose

internal/transform defines generated publication artifacts. internal/transform/markdown implements Markdown-to-HTML sidecar generation.

Inputs and outputs

Inputs are a validated source bundle and source backend. Outputs include destination path, source path, transform id, generated bytes, SHA-256, and size.

Registry

internal/transform defines the transform interface and registry. The app layer registers the Markdown implementation; publish planning receives only a resolver.

Markdown behavior

Markdown files ending in .md generate .html files in the same logical directory. Non-Markdown files do not generate outputs. Raw HTML embedded in Markdown is not passed through by the renderer.

Generated HTML is deterministic for the same source content and transform configuration.

See docs/integrations/markdown.md for the Goldmark integration contract.

Failure behavior

Transform resolution fails when a requested transform id is not registered. Markdown rendering fails when the source file cannot be read or rendered. Publish planning fails when HTML output is requested and the selected transform produces no outputs for a bundle.

Boundaries

Transforms do not publish files, mutate source bundles, or write destination state. Publish planning selects and writes transform outputs.

The app layer owns default transform registration. The transform package does not import concrete transform implementations.

Tests

Before changing transform behavior, inspect tests under:

  • internal/transform
  • internal/transform/markdown

Invariants

  • Source bundle files are never mutated by transforms.
  • Generated outputs record destination path, source path, transform id, SHA-256, and size.
  • Markdown sidecar naming changes only the .md extension to .html.
  • Non-Markdown source files do not generate Markdown outputs.
  • Transform registration stays outside publish planning.