NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist, #90 most downloaded on Packagist
Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)
Latest stable
2.10.7
Last release 21 days ago
31 Oct 2026
Release timing varies
gaps range from 8 days to 4 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
151 releases · first in 2014
Drag across the ruler to compare, or tap a release to open it.
Fixed Mentions inside of links creating nested links against the spec's rules
Simplified checks for thematic breaks
Optimized attribute parsing to avoid inspecting every space character (30% performance boost)
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Fixed incorrect parsing of tilde-fenced code blocks with leading spaces
Fixed incorrect error level for deprecation notices
Fixed HeadingPermalinkProcessor skipping text contents from certain nodes
HeadingPermalinkProcessor skipping text contents from certain nodes (#615)Added new MarkdownConverter class for creating converters with custom environments; this replaces the previously-deprecated Converter class
Please see https://commonmark.thephpleague.com/1.6/upgrading/ for important information about this release and the upcoming 2.0.0 version.
commonmark/enable_em (currently enable_em in 1.x)commonmark/enable_strong (currently enable_strong in 1.x)commonmark/use_asterisk (currently use_asterisk in 1.x)commonmark/use_underscore (currently use_underscore in 1.x)commonmark/unordered_list_markers (currently unordered_list_markers in 1.x)mentions/*/prefix (currently mentions/*/symbol in 1.x)mentions/*/pattern (currently mentions/*/regex in 1.x)max_nesting_level (currently supports int and float values in 1.x; will only support int in 2.0)MarkdownConverter class for creating converters with custom environments; this replaces the previously-deprecated Converter classRegexHelper::matchFirst() methodConfiguration::exists() methodmax_nesting_level option now defaults to PHP_INT_MAX instead of INFEnvironment into the constructors of CommonMarkConverter and GithubFlavoredMarkdownConverter; use MarkdownConverter insteadConfigurableEnvironmentInterface::setConfig(); use mergeConfig() insteadConfigurableEnvironmentInterface::mergeConfig() without any parametersConfiguration::get() and EnvironmentInterface::getConfig() without any parametersConfiguration::set() without the second $value parameterRegexHelper::matchAll(); use RegexHelper::matchFirst() insteadArrayCollection class; will be marked final in 2.0unordered_list_markers configuration optionFixed Table of Contents not rendering heading inlines properly (#587, #588)
Fixed mentions not being parsed when appearing after non-word characters
Blocks added outside of the parsing context now have their start/end line numbers defaulted to 0 to avoid type errors
Bumped CommonMark spec compliance to 0.28.2
textarea elements not being treated as a type 1 HTML block (like script, style, or pre)Fixed footnote ID configuration not taking effect (#524, #530)
Fixed regression of multi-byte inline parser characters not being matched
Significantly improved performance of the inline parser regex
Fixed UTF-8 encoding not being checked in the UrlEncoder utility (#509) or the Cursor
UrlEncoder utility (#509) or the CursorAdded a new heading_permalink/symbol configuration option to replace the now deprecated heading_permalink/inner_contents configuration option
AttributesExtension based on https://github.com/webuni/commonmark-attributes-extension (#474)FootnoteExtension based on https://github.com/rezozero/commonmark-ext-footnotes (#474)MentionExtension to replace InlineMentionParser with more flexibility and customizationTableOfContents nodes anywhere in a document (given by a placeholder)Node objectsrel attributes set via the ExternalLink extension (#476)heading_permalink/slug_normalizer configuration option to allow custom slug generation (#460)heading_permalink/symbol configuration option to replace the now deprecated heading_permalink/inner_contents configuration option (#505)SlugNormalizer and TextNormalizer classes to make normalization reusable by extensions (#485)TableOfContentsGeneratorTableOfContentsGeneratorInterfaceTableOfContentsPlaceholderTableOfContentsPlaceholderParserTableOfContentsPlaceholderRendererTableOfContents class into a new Node sub-namespace (with backward-compatibility)Reference, only the ReferenceMapCommonMarkConverter::VERSION constant (#496)League\CommonMark\Extension\Autolink\InlineMentionParser (use League\CommonMark\Extension\Mention\MentionParser instead)League\CommonMark\Extension\HeadingPermalink\Slug (use the classes under League\CommonMark\Normalizer instead)League\CommonMark\Extension\TableOfContents\TableOfContents (use the one in the new Node sub-namespace instead)STYLE_ and NORMALIZE_ constants in TableOfContentsBuilder (use the ones in TableOfContentsGenerator instead)\League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkRenderer::DEFAULT_INNER_CONTENTS constant (#505)heading_permalink/inner_contents configuration option in the HeadingPermalink extension (use the new heading_permalink/symbol configuration option instead) (#505)Fixed certain Unicode letters, numbers, and marks not being preserved when generating URL slugs
Fixed inline code blocks not be included within heading permalinks
Fixed BC break caused by ConverterInterface alias not being used by some DI containers
The Converter class has been deprecated; use CommonMarkConverter instead (#438, #439)
MarkdownConverterInterface as a long-term replacement for ConverterInterface (#439)DocumentPreParsedEvent event (#427, #359, #399)ListBlock::TYPE_BULLET constant as a replacement for ListBlock::TYPE_UNORDEREDMarkdownInput class and MarkdownInputInterface to handle pre-parsing and allow listeners to replace Markdown contentsListBlock constants now use fully-lowercased values instead of titlecased valuesStaggeredDelimiterProcessor returning from a void functionConverter class has been deprecated; use CommonMarkConverter instead (#438, #439)ConverterInterface has been deprecated; use MarkdownConverterInterface instead (#438, #439)bin/commonmark script has been deprecatedArrayCollection have been deprecated:
add()set()get()remove()isEmpty()contains()indexOf()containsKey()replaceWith()removeGaps()ListBlock::TYPE_UNORDERED constant has been deprecated, use ListBlock::TYPE_BULLET insteadFixed configuration/environment not being injected into event listeners when adding them via [$instance, 'method'] callable syntax
[$instance, 'method'] callable syntax (#440)Fixed event listeners not having the environment or configuration injected if they implemented the EnvironmentAwareInterface or ConfigurationAwareInte
EnvironmentAwareInterface or ConfigurationAwareInterface (#423)Optimized URL normalization in cases where URLs don't contain special characters (#417, #418)
Fixed return types of Environment::createCommonMarkEnvironment() and Environment::createGFMEnvironment()
Environment::createCommonMarkEnvironment() and Environment::createGFMEnvironment()ℹ️ Do you use league/commonmark-ext* packages? Those features are now included directly in this library! See #409 for details on making the switch.
ℹ️ Do you use league/commonmark-ext* packages? Those features are now included directly in this library! See #409 for details on making the switch.
unordered_list_markers configuration option (#408, #411)This release contains the same changes as 1.1.3:
This release contains the same changes as 1.1.3:
Introduced several micro-optimizations, reducing the parse time by 8%
Removed URL decoding step before encoding (more performant and better matches the JS library)
### Fixed - Fixed link parsing edge case
Fixed URL normalization not handling non-UTF-8 sequences properly (#395, #396)
Fixed handling of link destinations with unbalanced unescaped parens
Deprecated the Html5Entities class - use Html5EntityDecoder instead
Html5EntityDecoder class (#387)Html5Entities class - use Html5EntityDecoder instead (#387)No code changes have been introduced since 1.0.0-rc1
First stable release! 🎉
No code changes have been introduced since 1.0.0-rc1
Extracted a ReferenceMapInterface from the ReferenceMap class
ReferenceMapInterface from the ReferenceMap classReferenceMapInterface parameter to the Document constructorReferenceMap with ReferenceMapInterfaceReferenceMap::addReference() no longer returns $this"0" wouldn't be rendered (#376)Added event dispatcher functionality (#359, #372)
DocumentProcessorInterface functionality in favor of event dispatching (#373)Made the Delimiter class final and extracted a new DelimiterInterface
Delimiter class final and extracted a new DelimiterInterface
Delimiter methods:
getOrigDelims() renamed to getOriginalLength()getNumDelims() renamed to getLength()setNumDelims() renamed to setLength()DelimiterStackReferenceMapReferenceParserReferenceParser into the Reference sub-namespaceDelimiter methods:
setCanOpen()setCanClose()setChar()setIndex()setInlineNode()Delimiter (setter methods now have no return values)Removed all deprecated functionality:
This beta release fixes a couple of items that were not addressed in the previous beta.
DelimiterProcessorInterface::process() will accept any type of AbstractStringContainer now, not just Text nodesDelimiter constructor, getInlineNode(), and setInlineNode() no longer accept generic Node elements - only AbstractStringContainerssafe option (use html_input and allow_unsafe_links options instead)RegexHelper constantsDocParser::getEnvironment() (you should obtain it some other way)AbstractInlineContainer (use AbstractInline instead and make isContainer() return true)Un-deprecated the CommonmarkConverter::VERSION constant
See the upgrading guide for additional information.
addDelimiterProcessor() added to ConfigurableEnvironmentInterface and EnvironmentAdjacentTextMerger::mergeTextNodesBetweenExclusive()CommonMarkConveter::getEnvironment()Configuration::set()DocParserInterface created from DocParserConfigurationInterface created from ConfigurationReferenceInterface created from ReferenceConfiguration class:
getConfig() renamed to get()mergeConfig() renamed to merge()setConfig() renamed to replace()ConfigurationAwareInterface::setConfiguration() to accept the new ConfigurationInterface instead of the concrete classAdjoiningTextCollapser class to AdjacentTextMerger
collapseTextNodes() method with the new mergeChildNodes() methodfinal:
ConfigurationDocParserHtmlRendererInlineParserEngineNodeWalkerReferenceprivate:
DelimiterStack::findEarliest()protected methods in InlineParserEngine@internalElementRendererInterface now requires a public renderInline() method; added this to HtmlRendererInlineParserEngine::parse() to require an AbstractStringContainerBlock instead of the generic Node classCommonmarkConverter::VERSION constantConverter constructor now requires an instance of DocParserInterface instead of the concrete DocParserEmphasis, Strong, and AbstractWebResource to directly extend AbstractInline instead of the (now-deprecated) intermediary AbstractInlineContainer classNodes without parentsNodeWalkerEvent not requiring a Node via its constructorReference::normalizeReference() improperly converting to uppercase instead of performing proper Unicode case-foldingenable_strong is set to false (it now works identically to enable_em)DocParser::getEnvironment() (you should obtain it some other way)AbstractInlineContainer (use AbstractInline instead and make isContainer() return true)addInlineProcessor() from ConfigurableEnvironmentInterface and EnvironmentgetInlineProcessors() from EnvironmentInterface and EnvironmentEmphasisProcessorInlineProcessorInterfaceEmphasisParser now that we have proper delimiter supportgetEncoding() from ContextInterfacegetEncoding(), setEncoding(), and $encoding from ContextgetEncoding() and the second $encoding constructor param from CursorDelimiterStack::getTop() (no replacement)DelimiterStack::iterateByCharacters() (use the new processDelimiters() method instead)DelimiterStack::findMatchingOpener() methodFixed bug where elements with content of "0" wouldn't be rendered
"0" wouldn't be rendered (#376)Fixed bug where default values for nested configuration paths were inadvertently cast to strings
0.19.1 is an immediate follow-up to 0.19.0 which fixes issues with extensions that register other extensions.
0.19.1 is an immediate follow-up to 0.19.0 which fixes issues with extensions that register other extensions.
(While this technically introduces a BC-break, it's allowed under SemVer's rules for 0.x releases and is necessary for 0.19.x code to work as expected.)
addExtension() method to the new ConfigurableEnvironmentInterfaceRemoved previously-deprecated functionality:
The 50th release of league/commonmark is here! :tada:
The Environment and extension framework underwent some major changes in this release. Be sure to read the upgrade notes if you maintain any community extensions or have written custom functionality on top of this library.
add()ing them; you no longer need to rely on the order in which they are addedEnvironment:
EnvironmentInterfaceConfigurableEnvironmentInterfaceAbstractStringContainerBlock base class and corresponding StringContainerInterface from AbstractBlockCursor::getEncoding() method.phpstorm.meta.php file for better IDE code completionHtmlElement will now be escaped by defaultEnvironment is now a final classEnvironment::getBlockRendererForClass() was replaced with Environment::getBlockRenderersForClass() (note the added s)Environment::getInlineRendererForClass() was replaced with Environment::getInlineRenderersForClass() (note the added s)Environment::get____() methods now return an iterator instead of an arrayContext::addBlock() no longer returns the same block instance you passed into the method, as this served no useful purposeRegexHelper::isEscapable() no longer accepts null valuesNode::replaceChildren() now accepts any type of iterable, not just arraysAbstractStringContainerBlock instead of AbstractBlock
InlineContainerInterface now extends the new StringContainerInterfacehandleRemainingContents() method (formerly on AbstractBlock, now on AbstractStringContainerBlock) is now an `abstract methodInlineParserContext constructor now requires an AbstractStringContainerBlock instead of an AbstractBlockadd()ing parsers with just the target block/inline class name - you need to include the full namespace nowEnvironment:
getInlineParser($name)getInlineParsers()createInlineParserEngine()getName() methods:
AbstractBlockParser::getName()AbstractInlineParser::getName()BlockParserInterface::getName()InlinerParserInterface::getName()AbstractBlockParserAbstractInlinerParserInlineContainerAbstractBlock::acceptsLines() methodAbstractBlockInlineContainer classRegexHelper::$instanceRegexHelper::getInstance()RegexHelper::getPartialRegex()RegexHelper::getHtmlTagRegex()RegexHelper::getLinkTitleRegex()RegexHelper::getLinkDestinationBracesRegex()RegexHelper::getThematicBreakRegex()$preserveEntities parameter from Xml:escape()Fixed the adjoining Text collapser not handling the full tree (thephpleague/commonmark-ext-autolink#10)
Text collapser not handling the full tree (thephpleague/commonmark-ext-autolink#10)Modified how URL normalization decodes certain characters in order to align with the JS library's output
( in parenthesized link titleFix XSS vulnerability caused by improper preservation of entities when rendering
This is a security update release.
$preserveEntites argument of Xml::escape() for removal in the next release (#353)Deprecated the CommonmarkConverter::VERSION constant for removal in 1.0.0
Text elements not being collapsed after delimiter processingCommonmarkConverter::VERSION constant for removal in 1.0.0This release contains an important security update for CVE-2018-20583.
This release contains an important security update for CVE-2018-20583.
No breaking changes were introduced, but we did add a new interface: ConverterInterface. Consider depending on this interface in your code instead of…
No breaking changes were introduced, but we did add a new interface: ConverterInterface. Consider depending on this interface in your code instead of the concrete implementation. (See #330)
ConverterInterface to Converter and CommonMarkConverter (#330)ListItem::getListData() method (#329)target="_blank" will also get rel="noopener noreferrer" by default (#331)Fixed incorrect version constant value (again)
Added ListBlock::setTight() method
ListBlock::setTight() methodFixed incorrect version constant value
Added new RegexHelper::isEscapable() method
RegexHelper::isEscapable() methodAdded a new constant containing the current version: CommonMarkConverter::VERSION
CommonMarkConverter::VERSION (#314)This release contains several breaking changes and a minimum PHP version bump - see UPGRADE.md for more details.
This release contains several breaking changes and a minimum PHP version bump - see UPGRADE.md for more details.
max_nesting_level setting (#243)CursorRegexHelper are now defined as constants instead of being built on-the-fly.Cursor::saveState() now returns an array instead of a CursorState object.Cursor::restoreState() now accepts an array parameter instead of a CursorState object.RegexHelper is now final.InlineContainer changed to new InlineContainerInterface interface.MiscExtension::addInlineParser() and MiscExtension::addBlockRenderer() now return $this instead of nothing.Reference::normalizeReference() not properly collapsing whitespace to a single spaceRegexHelper::getInstance() and all instance (non-static) methods have been deprecated.InlineContainer interface has been deprecated. Use InlineContainerInterface instead.CursorState classCursor::getFirstNonSpacePosition()Cursor::getFirstNonSpaceCharacter()Cursor::advanceWhileMatches()Cursor::advanceToFirstNonSpace()ElementRendererInterface::escape()HtmlRenderer::escape()RegexHelper::REGEX_UNICODE_WHITESPACERegexHelper::getLinkDestinationRegex()This release contains breaking changes, several performance improvements, and two deprecations:
This release contains breaking changes, several performance improvements, and two deprecations:
Xml utility class; moved HTML/XML escaping logic into there (see deprecations below)Environment::getInlineParsersForCharacter() now returns an empty array (instead of null) when no matching parsers are foundfinal:
Html5EntitiesLinkParserHelperUrlEncoderThe following methods were deprecated and are scheduled for removal in 0.17.0 or 1.0.0 (whichever comes first). See UPGRADE.md for more information.
Cursor::advanceWhileMatches() deprecated; use Cursor::match() instead.HtmlRenderer::escape() deprecated; use Xml::escape() instead.DelimiterStack::findFirstMatchingOpener() which was previously deprecated in 0.15.0Improved performance of Cursor::advanceBy() (for a 16% performance boost!) :tada:
Cursor::advanceBy() (for a 16% performance boost!) :tada:Fixed URI normalization not properly encoding/decoding special characters in certain cases
This release bumps spec compliance to 0.28 without breaking changes to the API.
This release bumps spec compliance to 0.28 without breaking changes to the API.
LinkParserHelper::parseLinkDestination() to allow nested parens<pre> (it shouldn't) and not matching <iframe> (it should)] charactersAn unused constant and static method were deprecated and will be removed in a future release. See <UPGRADE.md> for more information.
RegexHelper::REGEX_UNICODE_WHITESPACE (no longer used)RegexHelper::getLinkDestinationRegex() (no longer used)advanceToNextNonSpaceOrNewline() - Identical replacement for the (now-deprecated) advanceToFirstNonSpace() method
Cursor (#280):
advanceToNextNonSpaceOrNewline() - Identical replacement for the (now-deprecated) advanceToFirstNonSpace() methodadvanceToNextNonSpaceOrTab() - Similar replacement for advanceToFirstNonSpace() but with proper tab handlinggetNextNonSpaceCharacter() - Identical replacement for the (now-deprecated) getFirstNonSpaceCharacter() methodgetNextNonSpacePosition() - Identical replacement for the (now-deprecated) getFirstNonSpacePosition() methodCursorState (#280):
getNextNonSpaceCache() - Identical replacement for the (now-deprecated) getFirstNonSpaceCache() methodAll deprecations listed here will be removed in a future 0.x release. See UPGRADE.md for instructions on preparing your code for the eventual removal of these methods.
Cursor::advanceToFirstNonSpace() (#280)
advanceToNextNonSpaceOrTab() or advanceToNextNonSpaceOrNewline() instead, depending on your requirementsCursor::getFirstNonSpaceCharacter() (#280)
Cursor::getNextNonSpaceCharacter() insteadCursor::getFirstNonSpacePosition() (#280)
Cursor::getNextNonSpacePosition() insteadCursorState::getFirstNonSpaceCache() (#280)
CursorState::getNextNonSpaceCache() insteadAllow inline parsers matching regex delimiter to be created (#271, #272)
One column per quarter.