Skip to content

[fuzz result] code block terminators can't be indented four spaces #861

@notriddle

Description

@notriddle

Try these two things out in the dingus. The first one has a string, that looks like a closing fence, indented four spaces. The second one is only indented three spaces.

 ~~~
    ~~~
 ~~~
   ~~~

The spec definitely wants the second one to be an empty code block, but it's a bit ambiguous about the first:

The closing code fence may be preceded by up to three spaces of indentation, and may be followed only by spaces or tabs, which are ignored.

Pulldown-cmark checks "spaces of indentation" relative to the indentation level of the opening fence, but the reference implementation, commonmark-hs and markdown-it all seem to check relative to the start of the line.

Details

Events from pulldown-cmark:

" ~~~#4\n    ~~~\n" -> [
  Start(CodeBlock(Fenced(Borrowed(""))))
  End(CodeBlock)
]

Events from pandoc:

" ~~~#4\n    ~~~\n" -> [
  Start(CodeBlock(Fenced(Borrowed(""))))
    Text(Boxed(" ~~~"))
  End(CodeBlock)
]

Events from commonmark.js:

" ~~~#4\n    ~~~\n" -> [
  Start(CodeBlock(Fenced(Borrowed(""))))
    Text(Boxed(" ~~~"))
  End(CodeBlock)
]

AST from pandoc:

Pandoc {
    meta: {},
    blocks: [
        CodeBlock(
            Attr(
                "",
                [
                    "#4",
                ],
                [],
            ),
            "   ~~~",
        ),
    ],
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions