# Step 1: table-renderer-fallbacks

## Read First
- /AGENTS.md
- /PLAN.md
- /PROGRESS.md
- /docs/HARNESS.md
- /docs/IMPLEMENTATION_PLAN.md
- /docs/CONVERSION_POLICY.md
- /phases/5-markdown-rendering-assets/step0.md

## Task
Implement table rendering policy for Markdown tables, limited HTML tables, and image fallback links.

Use structured table objects and avoid ad hoc string parsing for complex cases where possible.

## Sprint Contract
- Done means: simple tables render as Markdown, complex tables can render as limited HTML or fallback references, and table captions/footnotes are preserved.
- Hard thresholds: tests cover merged-cell-like structures, footnotes, captions, and table fallback decisions; invalid table output is detected by quality gates.
- Files owned: `src/pdftomd/renderer.py`, table models/tests, `PROGRESS.md`, phase index.
- Dependencies: Step 0 renderer and Phase 0 quality gates.

## Acceptance Criteria
```powershell
python scripts\validate_workspace.py
.\venv\python.exe -m pytest tests
```

## Verification
1. Run the acceptance commands.
2. Confirm fallback images are linked but not generated unless a table asset exists.
3. Update `PROGRESS.md` and this phase index.

## Do Not
- Do not fake table content that was not extracted.
- Do not discard captions or footnotes.
- Do not implement full HTML sanitizer scope beyond limited table output.
