Add Quarkdown render adapter boundary

This commit is contained in:
2026-05-15 14:46:32 +02:00
parent 0063fd8fcc
commit 63258161e6
11 changed files with 1139 additions and 10 deletions

66
docs/adapter-boundary.md Normal file
View File

@@ -0,0 +1,66 @@
# Markitect Quarkdown Adapter Boundary
`markitect-quarkdown` provides the concrete `render.quarkdown` adapter for the
Markitect render/export contract. Core `markitect-tool` owns the passive
request/result/artifact/provenance contracts; this repository owns Quarkdown
runtime behavior.
## Adapter Contract
The adapter supports:
- `inspect-profile`
- `export-source`
- `render-artifact`
`inspect-profile` and `export-source` do not invoke Quarkdown. `render-artifact`
requires a Quarkdown CLI plus runtime dependencies.
The adapter descriptor declares filesystem writes, external process execution,
native renderer dependency, and permission-controlled network behavior. Callers
can block render execution through Markitect request policy:
```python
RenderExportRequest(
source="# Demo",
operation="render-artifact",
profile="pdf",
policy={"external_process": False},
)
```
## Execution Plan
`build_quarkdown_execution_plan` produces an inspectable command plan with:
- Quarkdown command path
- source file path
- output directory
- expected artifact path
- Markitect profile
- Quarkdown document type
- output format
- permission flags
- runtime dependency notes
The default output directory is `quarkdown-output`. The default permission
allow-list is `project-read`, and network access is denied by default.
## Structured Failure
The adapter returns `RenderExportResult` diagnostics instead of raising for
expected render failures:
- `render.quarkdown.runtime_missing`
- `render.quarkdown.execution_failed`
- `render.quarkdown.artifact_missing`
- `render.quarkdown.artifact_extension`
- `render.quarkdown.artifact_empty`
- `render.quarkdown.capability_blocked`
## Artifact Validation
`validate_quarkdown_artifact` validates that the expected artifact exists, has
the expected extension, is non-empty, and receives a sha256 digest. The result
is a Markitect `RenderArtifact` with source-to-artifact provenance generated by
the adapter.

View File

@@ -0,0 +1,45 @@
# Permissions And Runtime
Quarkdown 2.x introduced compile-time permissions. The Markitect adapter treats
those as renderer-local execution controls, not as enterprise authorization.
## Permission Mapping
The adapter recognizes Quarkdown permission names as CLI flags:
- `project-read`
- `global-read`
- `network`
- `native-content`
- `all`
The default allow-list is:
```text
project-read
```
The adapter denies `network` by default unless callers explicitly opt out with
`deny_network: false`.
## Runtime Dependencies
The descriptor declares these optional runtime assumptions:
- Quarkdown 2.x CLI
- Java 17+
- Node.js, npm, and Puppeteer for PDF export
The test suite does not require those tools. It uses a fake runner for command
boundary tests and skips the real-runtime smoke check when `quarkdown` is not
available on `PATH`.
## Output Conventions
The default output directory is `quarkdown-output`. Expected artifact names are
derived from `artifact_stem` plus the profile extension, for example
`demo.pdf` for `profile=pdf`.
This repository owns those conventions and compatibility monitoring. Core
`markitect-tool` only sees `RenderExportResult`, `RenderArtifact`, diagnostics,
and provenance.

32
docs/profile-matrix.md Normal file
View File

@@ -0,0 +1,32 @@
# Quarkdown Profile Matrix
The adapter maps Markitect render profiles onto Quarkdown document/output
intent. The CLI command is still configurable because Quarkdown distribution
and command spelling may change across 2.x releases.
| Markitect profile | Quarkdown document type | Output format | Artifact media type | Extension |
| --- | --- | --- | --- | --- |
| `plain` | `plain` | `txt` | `text/plain` | `.txt` |
| `docs` | `docs` | `html` | `text/html` | `.html` |
| `slides` | `slides` | `html` | `text/html` | `.html` |
| `paged` | `paged` | `pdf` | `application/pdf` | `.pdf` |
| `static-site` | `docs` | `html` | `text/html` | `.html` |
| `pdf` | `paged` | `pdf` | `application/pdf` | `.pdf` |
PDF-oriented profiles require Quarkdown's PDF runtime path, including Java and
Node.js/npm/Puppeteer assumptions.
## Options
The adapter accepts these stable Markitect-facing options:
- `command`: Quarkdown command name or path, default `quarkdown`
- `workspace`: temporary working directory override
- `output_dir`: output directory, default `quarkdown-output`
- `artifact_stem`: expected artifact basename, default from source stem
- `permissions`: Quarkdown permission allow-list, default `project-read`
- `deny_network`: append a network deny flag, default `true`
- `dry_run`: return an execution-plan artifact without invoking Quarkdown
Renderer packages and automation may add extra options, but they should remain
under this adapter boundary rather than leaking into `markitect-tool`.