Run artifact

workspace/targets/commonmark/blueprint/FEATURE-Executable.md

FEATURE: Executable

FieldValue
Version20261014 V1
DescriptionThe commonmark executable reads UTF-8 Markdown on stdin, normalizes lines, and writes only HTML to stdout.
Depends OnARCHITECTURE.md
Provides./commonmark
Consumesmdparser.cli

Purpose

Deliver the executable commonmark at the application root. It takes no arguments.

Trigger

A process runs ./commonmark with Markdown on stdin.

Sequence

  1. Read all of stdin as bytes.
  2. Decode as UTF-8 with U+FFFD replacement for invalid bytes.
  3. Treat LF, CR and CRLF as line endings. Replace U+0000 with U+FFFD.
  4. Pass the lines to the parser entry point in mdparser.cli. Until the block engine story lands this may be a placeholder that renders no blocks.
  5. Write the rendered HTML to stdout as UTF-8 and exit 0.

Interface

Reads

Writes

Programmatic Acceptance

=== AC executable-empty-input ===
Intent: Empty standard input produces empty standard output and exit status 0 (AC-001).

import subprocess

result = subprocess.run(["./commonmark"], input="", capture_output=True, text=True) print(result.stdout) print(result.stderr) assert result.returncode == 0 assert len(result.stdout) == 0 === END AC executable-empty-input ===

=== AC executable-invalid-utf8 ===
Intent: Bytes that are not valid UTF-8 are decoded with replacement and the program exits 0 with decodable output (AC-002).

import subprocess

payload = b"\xff\xfe text \xc3\x28 end\n" result = subprocess.run(["./commonmark"], input=payload, capture_output=True) print(result.stdout) print(result.stderr) assert result.returncode == 0 result.stdout.decode("utf-8") === END AC executable-invalid-utf8 ===

=== AC executable-stdout-is-html-only ===
Intent: A normal run exits 0 and its stdout is valid UTF-8 text while diagnostics stay on stderr (AC-003).

import subprocess

source = "hello world\n\nsecond paragraph\n" result = subprocess.run(["./commonmark"], input=source.encode("utf-8"), capture_output=True) print(result.stdout) print(result.stderr) assert result.returncode == 0 result.stdout.decode("utf-8") === END AC executable-stdout-is-html-only ===

=== AC executable-line-endings ===
Intent: LF, CR and CRLF line endings yield identical output for the same document.

import subprocess

lines = "one", "two", "", "three" variants = ["\n".join(lines) + "\n", "\r\n".join(lines) + "\r\n", "\r".join(lines) + "\r"] outputs = [] for source in variants: result = subprocess.run(["./commonmark"], input=source.encode("utf-8"), capture_output=True) print(result.stdout) assert result.returncode == 0 outputs.append(result.stdout) assert outputs[0] == outputs[1] == outputs[2] === END AC executable-line-endings ===

=== AC executable-nul-replacement ===
Intent: U+0000 on input is treated exactly like U+FFFD (the spec's Insecure characters rule).
Encoding: utf-8

import subprocess

with_nul = "a\x00b\n" with_replacement = "a\ufffdb\n" first = subprocess.run(["./commonmark"], input=with_nul, capture_output=True, text=True, encoding="utf-8") second = subprocess.run(["./commonmark"], input=with_replacement, capture_output=True, text=True, encoding="utf-8") print(first.stdout) assert first.returncode == 0 assert second.returncode == 0 assert first.stdout == second.stdout === END AC executable-nul-replacement ===

User Acceptance

Guardrails