Run artifact

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

FEATURE: Emphasis

FieldValue
Version20261014 V1
DescriptionImplement the delimiter stack, flanking rules and the Appendix process-emphasis algorithm for emphasis and strong emphasis.
Depends OnFEATURE-Entities.md
Providesdelimiter stack, process_emphasis procedure
Consumesinline scanner loop

Purpose

Implement the Emphasis and strong emphasis section of the spec using the Appendix algorithm directly.

Delimiter stack

process_emphasis(stack_bottom)

Reads

Writes

Programmatic Acceptance

The corpus section includes links in rule 9 and rule 17 examples, so it is gated in the images story. The checks here are bounded and structural.

=== AC emphasis-star-and-underscore ===
Intent: Single star and single underscore wrap supplied words in one em element each.

import subprocess

word = "wordy" for mark in ("*", "_"): result = subprocess.run(["./commonmark"], input=mark + word + mark + "\n", capture_output=True, text=True) print(result.stdout) assert result.returncode == 0 assert result.stdout.count("<em>") == 1 assert result.stdout.count("<strong>") == 0 assert word in result.stdout === END AC emphasis-star-and-underscore ===

=== AC emphasis-strong ===
Intent: Doubled delimiters produce one strong element.

import subprocess

word = "wordy" for mark in ("**", "__"): result = subprocess.run(["./commonmark"], input=mark + word + mark + "\n", capture_output=True, text=True) print(result.stdout) assert result.returncode == 0 assert result.stdout.count("<strong>") == 1 assert result.stdout.count("<em>") == 0 === END AC emphasis-strong ===

=== AC emphasis-intraword-rules ===
Intent: Intraword emphasis works with star but not with underscore.

import subprocess

star = subprocess.run(["./commonmark"], input="foo*bar*baz\n", capture_output=True, text=True) under = subprocess.run(["./commonmark"], input="foo_bar_baz\n", capture_output=True, text=True) print(star.stdout) print(under.stdout) assert star.returncode == 0 assert under.returncode == 0 assert star.stdout.count("<em>") == 1 assert under.stdout.count("<em>") == 0 === END AC emphasis-intraword-rules ===

=== AC emphasis-flanking-whitespace ===
Intent: A delimiter run followed or preceded by whitespace does not form emphasis.

import subprocess

result = subprocess.run(["./commonmark"], input="a * foo bar*\n\nfoo bar *\n", capture_output=True, text=True) print(result.stdout) assert result.returncode == 0 assert result.stdout.count("<em>") == 0 === END AC emphasis-flanking-whitespace ===

=== AC emphasis-nesting ===
Intent: Triple delimiters give one em containing one strong, and nested forms keep both elements.

import subprocess

triple = subprocess.run(["./commonmark"], input="word\n", capture_output=True, text=True) nested = subprocess.run(["./commonmark"], input="a b c\n", capture_output=True, text=True) print(triple.stdout) print(nested.stdout) assert triple.returncode == 0 assert nested.returncode == 0 assert triple.stdout.count("<em>") == 1 assert triple.stdout.count("<strong>") == 1 assert nested.stdout.count("<em>") == 1 assert nested.stdout.count("<strong>") == 1 === END AC emphasis-nesting ===

=== AC emphasis-code-span-binds-tighter ===
Intent: A star inside a code span cannot close emphasis.

import subprocess

result = subprocess.run(["./commonmark"], input="*foo*\n", capture_output=True, text=True) print(result.stdout) assert result.returncode == 0 assert result.stdout.count("<em>") == 0 assert result.stdout.count("<code>") == 1 === END AC emphasis-code-span-binds-tighter ===

User Acceptance

Guardrails