With the 2.0.0 stable release of
league/commonmark scheduled for next month, I’m pleased to share that the first 2.0 beta releases are now available! Current users of this library are highly encouraged to test this new branch and provide feedback.
You can install the beta release via Composer:
composer require league/commonmark:^[email protected]
What’s new in 2.0?
There’s so much to cover - I’ll likely need to write a separate blog post about that. But here are the key improvements and changes:
- Up to 50% faster and 21% less memory usage, especially when dealing with larger Markdown documents
- Three new extensions for Front Matter, Description Lists, and Default HTML Attributes
- A new XML renderer to simplify AST debugging
- Completely revamped parsing engine for faster speed and more precise parsing control (for blocks, inlines, and delimiters)
- A unified rendering approach for both blocks and inlines
- Compatibility with PSR-14 event dispatcher libraries
- Psalm purity markers throughout the codebase
- Tons more!
I’ll share more details on this, including the new benchmarks, closer to the 2.0.0 stable release. In the meantime, I’d highly recommend reviewing the upgrading guide and
CHANGELOG for additional details on what’s changed and how you can start testing 2.0 today.
This is going to be the most exciting release and I can’t wait to share it with all of you!
Correction: A previous revision of this post claimed “up to 70%” performance improvement. I divided by the wrong number - it’s actually 50%.