Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code blocks sometimes don't render first character #981

Open
JimKnoxx opened this issue Jun 7, 2023 · 1 comment
Open

Code blocks sometimes don't render first character #981

JimKnoxx opened this issue Jun 7, 2023 · 1 comment
Labels
bug Something isn't working right do not close Issue which won't close due to inactivity spec compliance Issues or question about compliance with the CommonMark or GFM specs
Milestone

Comments

@JimKnoxx
Copy link

JimKnoxx commented Jun 7, 2023

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

@colinodell colinodell added bug Something isn't working right spec compliance Issues or question about compliance with the CommonMark or GFM specs labels Jun 7, 2023
@colinodell
Copy link
Member

This type of issue tends to happen when tabs are used for indentation and we forget to advance the cursor by column (instead of by character). This should be a straightforward fix once we identify exactly where this is happening.

@colinodell colinodell added the do not close Issue which won't close due to inactivity label Jul 31, 2023
@colinodell colinodell added this to the v2.5 milestone Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working right do not close Issue which won't close due to inactivity spec compliance Issues or question about compliance with the CommonMark or GFM specs
Projects
None yet
Development

No branches or pull requests

2 participants