Skip to content

Add Markdown standard library types (MdInline, MdBlock); v0.0.84#275

Merged
aallan merged 1 commit into
mainfrom
feat/147-markdown-stdlib
Mar 11, 2026
Merged

Add Markdown standard library types (MdInline, MdBlock); v0.0.84#275
aallan merged 1 commit into
mainfrom
feat/147-markdown-stdlib

Conversation

@aallan

@aallan aallan commented Mar 11, 2026

Copy link
Copy Markdown
Owner

Summary

Closes #147.

  • Adds two mutually-recursive ADTs: MdInline (6 constructors: MdText, MdCode, MdEmph, MdStrong, MdLink, MdImage) and MdBlock (8 constructors: MdParagraph, MdHeading, MdCodeBlock, MdBlockQuote, MdList, MdThematicBreak, MdTable, MdDocument)
  • Adds 5 pure functions as WASM host imports: md_parse, md_render, md_has_heading, md_has_code_block, md_extract_code_blocks
  • Hand-written Python Markdown parser (~650 lines) with no external dependency — supports ATX headings, fenced code blocks, block quotes, lists, tables, thematic breaks, emphasis, strong, code spans, links, images
  • Establishes the host-side binding pattern for pure functions: WASM import interface is the portability contract; any host runtime (Python, JS, Rust) provides matching implementations for the same .wasm binary
  • Reorganizes spec §9.3 (Built-in ADTs) to graduate UrlParts and Future<T> from inline definitions
  • Fixes _is_void_expr bug (IfExpr attribute names)
  • Bumps to v0.0.84

New files: vera/markdown.py (parser/renderer), vera/wasm/markdown.py (WASM marshalling), examples/markdown.vera, tests/conformance/ch09_markdown.vera, tests/test_markdown.py

Test plan

  • 2175 tests pass (6 skipped), including ~30 new parser/renderer unit tests, 6 type-checker tests, 8 codegen integration tests
  • 52 conformance programs pass (new: ch09_markdown.vera)
  • 23 examples pass (new: markdown.vera)
  • mypy clean
  • All validation scripts clean (spec, README, SKILL block checks)
  • Pre-commit hooks pass

🤖 Generated with Claude Code

…nctions; bump to v0.0.84

Implements issue #147: typed Markdown ADTs with 14 constructors across two
mutually-recursive types (MdInline with 6, MdBlock with 8) and five pure
functions (md_parse, md_render, md_has_heading, md_has_code_block,
md_extract_code_blocks) as WASM host imports backed by a hand-written
Python parser — no external dependency.

This establishes the host-side binding pattern for pure functions: the WASM
import interface is the portability contract, and any host runtime (Python,
JS, Rust) can provide matching implementations for the same .wasm binary.

Also reorganizes spec §9.3 (Built-in ADTs) to graduate UrlParts and
Future<T> from their inline definitions, and fixes a bug in _is_void_expr
(IfExpr attribute names).

Co-Authored-By: Claude <noreply@anthropic.invalid>
@aallan aallan merged commit fa1d56b into main Mar 11, 2026
10 checks passed
@aallan aallan deleted the feat/147-markdown-stdlib branch March 11, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown standard library type

1 participant