docs: resolve indented code block + tab expansion decision - #15
Merged
Merged
Conversation
Indented code blocks are already implemented and conform (baseline
Indented code blocks: 12/12); tab expansion is partial (Tabs: 6/11).
Record the resolved decision as a design invariant in ARCHITECTURE.md:
indented code IS supported and stays on by default, with the tab
expansion status and remaining gaps documented.
Expose a low-risk opt-out `renderMarkdown(md, { indentedCode: false })`
(RenderMarkdownOptions) that renders top-level indented lines as prose
paragraphs. It threads through RenderBlocksOptions.indentedCode
(default true), so the default path — and the conformance baseline —
is unchanged. Add targeted unit tests for both the opt-out and the
default/explicit-true behavior.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Cv1iyJb9PHMFG3YGp6ffkT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #9, which asked for a decision between (1) implementing 4-space indented code blocks + tab expansion, or (2) documenting the divergence (optionally behind an
indentedCode: falseparser option).The issue was stale. Since it was filed, indented code blocks have already been implemented and now conform: the conformance baseline (
summaryBySectionintests/fixtures/commonmark/conformance-baseline.json) records Indented code blocks: 12/12 and Tabs: 6/11. Tokenizing happens inblock-tokenizer.ts(indented_code) and emission inrenderIndentedCode(render-blocks.ts). So the decision is effectively already made toward option (1) for indented code.This PR documents that resolved decision and adds a low-risk opt-out option.
What changed
Documentation (the core of the ask) — new
Indented code blocks (#9)design invariant indocs/ARCHITECTURE.md:Tabscount rising on re-baseline). A short note was also added to the README.Opt-out option (chose to add it — the plumbing was cheap and clean) —
renderMarkdownalready funneled intorenderBlocksvia an options object (htmlFromIndent), so exposing the toggle was localized and did not require touching the tokenizer:renderMarkdown(md, { indentedCode?: boolean })— newRenderMarkdownOptions(defaulttrue), exported fromindex.ts.RenderBlocksOptions.indentedCode(defaulttrue) and handled inrenderSingleBlock: whenfalse, a top-levelindented_codeblock renders as a prose paragraph instead of<pre><code>. Applied at the top level only — recursive list/blockquote content keeps CommonMark indented-code semantics.Default behavior is byte-for-byte unchanged, so the conformance baseline is untouched. Added targeted unit tests:
{ indentedCode: false }renderscodeas<p>code</p>; default and explicittruestill produce<pre><code>.Verification
npm run typecheck— cleannpm test— 378/378 pass (conformance baseline unchanged)npm run build— cleanCloses #9
🤖 Generated with Claude Code
https://claude.ai/code/session_01Cv1iyJb9PHMFG3YGp6ffkT
Generated by Claude Code