8000 [Bug]: cannot parse indented content · Issue #1388 · google/zx · GitHub
[go: up one dir, main page]

Skip to content

[Bug]: cannot parse indented content #1388

Open

Description

@wighawag

What happened?

zx fails with SyntaxError: Unexpected identifier 'assumes' when given the following markdown file: https://github.com/wighawag/template-ethereum-contracts/blob/593bb65e0c3ebffaff0d1c4b938c48003a5cdfdc/README.md?plain=1

How it should work?

it should parse it and execute what is in the code blocks

How to reproduce the bug?

create a file README.md with the content above

and execute

zx README.md

Version

8.8.5

What's OS kind?

Linux

What JS runtime is used?

Node.js

Runtime Version

24.11.1

Error stack / relevant log output

SyntaxError: Unexpected identifier 'assumes'

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. changed the title [-][Bug]: cannot parse intended content[/-] [+][Bug]: cannot parse indented content[/+] on Jan 24, 2026
  2. added a commit that references this issue on Feb 6, 2026
    5e4ccaf
  3. added a commit that references this issue on Sep 29, 2026
    915960a
  4. Anjaliavv51 commented on Oct 21, 2026

    @Anjaliavv51

    Hi @antongolub, I'd like to work on resolving this issue.

    I looked into the root cause and saw that while #1419 successfully addressed indented code fences, this case still fails on indented list prose (e.g., This assumes...).

    Because tabRe = /^( +|\t)/ matches 2 or more spaces after an empty line, prose indented under a list item with 2 spaces is classified as raw JavaScript rather than Markdown prose (which should be commented out with // ).

    Under CommonMark specifications (section 4.4), indented code blocks require 4 spaces or a tab, whereas 2-space indentation represents continuing list item content.

    Would you prefer:

    1. Updating tabRe to require 4 spaces or a tab (/^( {4,}|\t)/), aligning with CommonMark?
    2. Or maintaining 2-space indentation for backwards compatibility while detecting list continuation contexts?

    If option 1 is acceptable, I can submit a clean PR with regression tests in test/md.test.ts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0