Skip to content

Remark mis-parses nested code blocks in list items #315

@infotexture

Description

@infotexture

When code blocks are nested within list items with CommonMark's 7-space (3+4=7) indentation rule, remark fails to recognize the code blocks and treats them as nested paragraphs in the list item rather than <code>.

Steps to reproduce

This CommonMark playground example shows how CommonMark handles nested code blocks within list items with various indentations.

TL;DR: CommonMark recognizes 7-space indents as code blocks in single-digit ordered list items.

Expected behaviour

The parsed remark AST should be same as the result in the CommonMark playground.

Actual behaviour

The remark parser fails to recognize CommonMark's (3+4=7) indentation for code blocks within list items and treats them as nested paragraphs in the list item rather than <code>.

This Prettier playground example shows how remark stumbles on the 7-space indentation.

(See prettier/prettier#3459 for the initial discussion and additional examples.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions