FEATURE: CLI Entry Point
| Field | Value |
|---|---|
| Version | 20260812 V1 |
| Description | Provides the executable standard-input and standard-output CommonMark interface. |
| Depends On | ARCHITECTURE.md |
| Provides | parser executable |
| Consumes | parser core, HTML renderer |
Workflow
The executable reads UTF-8 Markdown from standard input. It parses block structure before inline structure, renders the resulting document as HTML, and writes only rendered HTML to standard output. A successful invocation exits with status 0.
The executable is named cmark and is invokable from the build directory as ./cmark. It supports the supplied harness's program invocation contract.
Programmatic Acceptance
Requires: executable=cmark; scope=test
=== AC cli-stdin-stdout ===
Intent: The executable renders Markdown supplied through standard input and exits successfully.
import subprocess
result = subprocess.run( ["./cmark"], input="# Hello\n\nworld\n", capture_output=True, text=True, encoding="utf-8", ) print(result.stdout) print(result.stderr, file=import("sys").stderr) assert result.returncode == 0 assert result.stdout == "<h1>Hello</h1>\n<p>world</p>\n" === END AC cli-stdin-stdout ===
=== AC cli-utf8 ===
Intent: The executable accepts UTF-8 Markdown and emits UTF-8 HTML.
import subprocess
result = subprocess.run( ["./cmark"], input="cafe\n", capture_output=True, text=True, encoding="utf-8", ) assert result.returncode == 0 assert result.stdout == "<p>cafe</p>\n" === END AC cli-utf8 ===
User Acceptance
- None.
Guardrails
- Markdown input is read from standard input.
- Rendered HTML is written to standard output.
- The executable does not write diagnostics into standard output during successful parsing.