Commonmark Markdown Parser v2.0 Beta 3 Released

News

July 6th, 2021

Commonmark Markdown Parser v2.0 Beta 3 Released

The PHP League commonmark Markdown parser released a beta version of the upcoming v2.0.0 stable release (likely July). This package is a highly-extensible PHP Markdown parser which fully supports the CommonMark and GFM specs:

According to the beta announcement, the key improvements in v2.0 include:

  • 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!

The author, Colin O'Dell, has asked for current users to help test and provide feedback. The Laravel framework relies on commonmark as a dependency, and Laravel users are highly encouraged to support this library by providing feedback and testing.

To help test this upcoming version, you can check out the beta version of the package with the following composer command:

composer require league/commonmark:^2.0@beta

Learn More

I'd recommend checking out the commonmark CHANGELOG for full details on what's changed and new in v2.0. The Upgrading from 1.6 to 2.0 guide will also get you ready for upgrading existing applications. Lastly, check out Colin's beta announcement post for details on the upgrade and how to sponsor his work.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.