Skip to content

#1388 fix: align indented code block threshold with CommonMark - #1537

Closed
Anjaliavv51 wants to merge 2 commits into
google:mainfrom
Anjaliavv51:main
Closed

Anjaliavv51 wants to merge 2 commits into
google:mainfrom
Anjaliavv51:main

Conversation

@Anjaliavv51

@Anjaliavv51 Anjaliavv51 commented Oct 30, 2026 •

Copy link
Copy Markdown

Fixes #1388

Problem

Running zx README.md fails with SyntaxError: Unexpected identifier 'assumes' when a Markdown file contains 2-space indented prose inside a list item.

While PR #1419 addressed indented code fences, the Markdown processor's tabRe = /^( +|\t)/ matches 2 or more spaces after a blank line. Consequently, continuing prose indented under a list item with 2 spaces is classified as raw code instead of Markdown prose (which should be commented out with // ).

Solution

Per CommonMark specifications (Section 4.4), indented code blocks require 4 spaces or a tab. Update tabRe from /^( +|\t)/ to /^( {4,}|\t)/ so that 2-space indented list prose is preserved as comments and only true indented code blocks (4+ spaces or tabs) are emitted as raw code.

import {$} from 'zx'

// Markdown with 2-space indented prose in list items now runs cleanly:
// - item
//   prose indented with 2 spaces is commented out as expected

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.

[Bug]: cannot parse indented content

1 participant