Existing code is in place from earlier blocks. Let me read the block engine and related modules before adding the indented code rule.The indented-code rule has to fit the existing per-line procedure. Before writing it, I'll check which existing tests assume four-space lines are paragraphs, since those would change behaviour.The current suite is green (755 passed). Several earlier-block tests assert that four-space lines are paragraphs, which this feature changes by definition. I'll check whether any of them are declared acceptance checks before touching them.The existing thematic-break and ATX tests that expect ` ***` or `\t# foo` to be paragraphs are finer tests, not declared acceptance checks. Under this feature those lines become code blocks, so I'll update those expectations. The declared ATX checks still hold, since `refused` has no `<h1>`.
Now I'll add the block type to the engine.Engine and renderer are wired. Next I'll write the test file, transcribing the four declared checks unchanged and adding finer tests that read back block trees and exact output.Now I'll update the five finer-grained expectations that assumed four-space or tab-indented lines were paragraphs. The declared ATX checks are untouched.Now I'll run the full project suite through its declared command, plus the declared checks' Python-level invocation.Four failures, all from my side of the change. Three are finer tests whose inputs now fall outside the paragraph case. One is a mistake in my own test, so I'll check the registry test before fixing.The registry test lists the start rules explicitly, so it needs the new one. The other two inputs (` \t word`, ` \tword`) have 4+ columns of indentation, so they are now correctly code blocks; I'll use space-only indentation to keep the paragraph intent. My own consecutive-block test was wrong: `b` is a paragraph, and ` c` continues it.Re-running the full suite after those fixes.Indented code blocks are implemented, and the project suite is green: 797 passed, 1 skipped. The skip was already there before this change. I did not run `sources/full_test.sh`, because this step's criteria gate only on the declared checks; the corpus examples that use lists belong to the lists story.
I also changed five earlier-block tests whose expectations conflicted with the new rule: four-space or tab-indented lines were asserted to be paragraphs, and two inputs had 4+ columns of indentation. The declared ATX and thematic-break checks are untouched.
**What changed**
- `mdparser/blocks.py`: new `INDENTED_CODE` block type, registered after ATX headings.
- Start: a non-blank line with 4+ columns of indentation, unless the container is a leaf that takes lines (the paragraph case), so it cannot interrupt a paragraph.
- Continue: blank lines and 4+ column lines; the first four columns are consumed, and anything beyond is kept.
- Finalize: trailing blank lines are dropped; content is the remaining lines, each with a line ending.
- `mdparser/render.py`: renders `<pre><code>` with escaped content.
- `tests/test_indented_code.py` (new): the four declared checks transcribed unchanged, plus block-tree and exact-output tests.
**Earlier tests I updated (finer tests, not declared checks)**
- `test_atx_headings.py`: ` # foo` and `\t# foo` now expect `indented_code`.
- `test_thematic_breaks.py`: ` ***` and `\t***` expect `indented_code`; the exact-output test now expects a code block.
- `test_blocks.py`: the registry start-rule list includes `INDENTED_CODE`; the leading-whitespace test uses space-only indentation, because any tab in leading whitespace reaches column 4.
- `test_block_engine.py`: ` \tword` became ` word`, for the same reason.
**Decisions**
- The start rule gates on "container accepts lines" rather than naming the paragraph type, so future leaf types that take lines get the same no-interrupt behaviour.
**Results**
- Declared checks (`test_indented_code.py`, 4 of 4): pass.
- Full `pytest -q`: 797 passed, 1 skipped (pre-existing skip in `test_foundation.py`). It was 755 passed before this change.
RESULT: SUCCESS
FILES CHANGED:
- mdparser/blocks.py
- mdparser/render.py
- tests/test_indented_code.py
- tests/test_atx_headings.py
- tests/test_thematic_breaks.py
- tests/test_blocks.py
- tests/test_block_engine.py
SUMMARY:
Added the indented code block type (start, continue, add-line, finalize) and its HTML rendering. The four declared acceptance checks pass. The full pytest suite is green at 797 passed, 1 skipped (pre-existing). Five earlier finer tests were updated to the new four-column rule; the declared ATX and thematic-break checks are unchanged. The conformance suite was not run, as this step's criteria do not invoke it.
<blueprint-decisions>
[{"spec":"FEATURE-Indented-Code.md","severity":"Low","subject":"Start gate for indented code","decision":"The start rule refuses whenever the container is a leaf that takes lines, rather than checking for the paragraph type by name. This keeps the no-interrupt rule general. Acceptable as is?"}]
</blueprint-decisions>Run artifact