Skip to content

Fixes a bug causing multiline list items to be clipped#16

Merged
brendt merged 1 commit into
tempestphp:mainfrom
PiranhaGeorge:main
Jul 13, 2026
Merged

Fixes a bug causing multiline list items to be clipped#16
brendt merged 1 commit into
tempestphp:mainfrom
PiranhaGeorge:main

Conversation

@PiranhaGeorge

Copy link
Copy Markdown
Contributor

When list item text is wrapped onto multiple lines, e.g.:

- First item
- A really long
  second item
- Third item

The list item is cut off resulting in output like this:

  • First item
  • A really long
  • Third item

This PR fixes it.

@brendt

brendt commented Jul 13, 2026

Copy link
Copy Markdown
Member

I don't think this is supported by the markdown spec: https://www.markdownguide.org/basic-syntax/#lists-1

I'm not against adding it, but it should be done without regex

@PiranhaGeorge

Copy link
Copy Markdown
Contributor Author

Understood. I was confused about the spec myself, but LSPs seem to support multiline list items.

What's the intention for this package? It has some extended markdown, so I guess not pure markdown? Or will this be a Tempest flavoured markdown?

I personally don't mind if the output from multiline list items also span multiple lines, but I guess the author only intends to improve readability not introduce 'formatting'?

Do you think the correct approach is to use the parser, something like this:

$content = $parser->withRules(new ForceSingleLineRule())->lex($content . ' ' . $childContent)[0]->parse($parser);

Or should I use an explode/implode combo?

Just trying to get my head around the philosophy here.

Other than this small issue, the package has worked flawlessly for my content. Thanks for your hard work on this!

@brendt

brendt commented Jul 13, 2026

Copy link
Copy Markdown
Member

I'm fine adding support for it just built-in. I don't necessarily mind about not being 100% spec compliant, as long as most of the use cases work out of the box :)

I didn't realize you're using preg_replace, from a quick scan I thought you were using regex for lexing, which isn't the case. Then I'm fine with it :) I'll wait for CI and merge

@github-actions

Copy link
Copy Markdown

Benchmark Results

Comparison of main against main (a2b1f34be6db94f74bc4d6e98ff3e412a4894a01).

Open to see the benchmark results

No benchmark changes above ±5%.

Generated by phpbench against commit 5ede707

@brendt
brendt merged commit 58298b9 into tempestphp:main Jul 13, 2026
3 of 4 checks passed
@brendt

brendt commented Jul 13, 2026

Copy link
Copy Markdown
Member

The failing test had nothing to do with your PR, so thanks!

@brendt

brendt commented Jul 13, 2026

Copy link
Copy Markdown
Member

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants