Skip to content

Replace unmaintained markdown parser library with a new one#78

Merged
williamdes merged 1 commit intocode-lts:mainfrom
GuySartorelli:pulls/main/replace-parsdown
Nov 17, 2025
Merged

Replace unmaintained markdown parser library with a new one#78
williamdes merged 1 commit intocode-lts:mainfrom
GuySartorelli:pulls/main/replace-parsdown

Conversation

@GuySartorelli
Copy link
Contributor

Replaces erusev/parsedown with league/commonmark

The following 6 unit tests were failing prior to this change:

1) Doctum\Tests\Console\CommandHelpTest::testParseHelp
Failed asserting that two strings are identical.
/home/gsartorelli/dump/temp/cloned/doctum/tests/Console/CommandHelpTest.php:35

2) Doctum\Tests\Console\CommandHelpTest::testRenderHelp
Failed asserting that two strings are identical.
/home/gsartorelli/dump/temp/cloned/doctum/tests/Console/CommandHelpTest.php:57

3) Doctum\Tests\Console\CommandHelpTest::testUpdateHelp
Failed asserting that two strings are identical.
/home/gsartorelli/dump/temp/cloned/doctum/tests/Console/CommandHelpTest.php:72

4) Doctum\Tests\Console\CommandTest::testParseEndBeforeStart
Failed asserting that two strings are identical.
/home/gsartorelli/dump/temp/cloned/doctum/tests/Console/CommandTest.php:29

5) Doctum\Tests\Console\CommandTest::testRenderEndBeforeStart
Failed asserting that two strings are identical.
/home/gsartorelli/dump/temp/cloned/doctum/tests/Console/CommandTest.php:49

6) Doctum\Tests\Console\CommandTest::testUpdateCommandRun
Failed asserting that two strings are identical.
/home/gsartorelli/dump/temp/cloned/doctum/tests/Console/CommandTest.php:81

The remaining failures all look benign - the new package deals with HTML and whitespace differently than the old one. Specifically it doesn't trim whitespace, and it seems to adhere to the HTML5 spec and massages malformed HTML into valid HTML.

I've left the failing tests as they are so that you can see for yourself what the differences are. If you're happy with the changes let me know and I'll fix up the tests that are failing as a result of this change (i.e not the above 6).
Note that there are some configuration options for league/commonmark, but none of them include "don't fix broken HTML" or "trim whitespace" so using this library we won't get identical results to the previous one without significant effort.

@GuySartorelli GuySartorelli marked this pull request as draft November 13, 2025 20:48
@GuySartorelli GuySartorelli mentioned this pull request Nov 13, 2025
@williamdes williamdes marked this pull request as ready for review November 13, 2025 22:26
@williamdes williamdes marked this pull request as draft November 13, 2025 22:26
Copy link
Member

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much, you can go ahead with the tests

I doubt we will have much complaints

@GuySartorelli GuySartorelli force-pushed the pulls/main/replace-parsdown branch from 2963aad to f9361ce Compare November 13, 2025 22:46
@GuySartorelli GuySartorelli marked this pull request as ready for review November 13, 2025 22:46
@GuySartorelli
Copy link
Contributor Author

Done. As noted in the PR description the 6 remaining unit failures fail without this PR so I haven't touched those.

Copy link
Member

@williamdes williamdes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I will update the other unhappy tests
the link transform was useful, I may write some code to save it

@williamdes williamdes added this to the v5.6.0 milestone Nov 17, 2025
@williamdes williamdes merged commit f124879 into code-lts:main Nov 17, 2025
16 of 39 checks passed
@GuySartorelli GuySartorelli deleted the pulls/main/replace-parsdown branch November 17, 2025 23:55
williamdes added a commit that referenced this pull request Jan 11, 2026
…h a new one"

This reverts commit f124879, reversing
changes made to 11cfd92.

And uses the new fork of the library
@williamdes
Copy link
Member

I am waiting on parsedown/parsedown#7 before updating the phar.
This PR was reverted (thanks for the typo fix!) and I used the new fork of the library.
See: f7b7362

Will keep you updated, if this goes nowhere I will go back to your solution 🙏🏻

@williamdes williamdes self-assigned this Jan 21, 2026
@williamdes
Copy link
Member

Seems to work, new fork helped me.
All tests are good since 44b0a18

@williamdes
Copy link
Member

Symfony v8 support added, -dev phar released. Testing time !

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