Skip to content

Code blocks sometimes don't render first character #981

Open
@JimKnoxx

Description

Version(s) affected

2.3, 2.4

Description

Hey there
We switched our markdown interpreter to commonmark. While reviewing old texts with the new markdown interpreter I noticed a strange behavior. In a special scenario with code blocks, tabs and lists, the resulting markdown 'forgets' the first character of a given code block.
I can reproduce it in a commonmark only project and will give you the code example below.

How to reproduce

I had a clean folder and only run composer require league/commonmark.
I created a index.php and filled it with following code:

<?php

require __DIR__ . '/vendor/autoload.php';

use League\CommonMark\CommonMarkConverter;

$converter = new CommonMarkConverter();

$str = <<<EOD
# Stuff

- Something more:
	```
	What's happening?
	```
EOD;

echo $converter->convert($str);

I ran php -S localhost:8000 -t .

The resulting output is:
image

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working rightdo not closeIssue which won't close due to inactivityspec complianceIssues or question about compliance with the CommonMark or GFM specs

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions