Changelog
All notable changes made in 2.x releases are shown below. See the full list of releases for the complete changelog.
2.7.1 - 2025-07-20
Notable Changes
Changed
- Optimized several regular expressions in
RegexHelperto improve performance (#674, #1086)
Fixed
EmbedProcessorno longer callsupdateEmbeds()when there are no embeds to update (#1081)- Fixed missing
benchmark.phpCSV path validation for non-existent files (#1068, #1085)
New Contributors
- @driesvints made their first contribution in https://github.com/thephpleague/commonmark/pull/1077
- @adielcristo made their first contribution in https://github.com/thephpleague/commonmark/pull/1079
- @Copilot made their first contribution in https://github.com/thephpleague/commonmark/pull/1085
Full Changelog: https://github.com/thephpleague/commonmark/compare/2.7.0…2.7.1
2.7.0 - 2025-05-05
This is a security release to address a potential cross-site scripting (XSS) vulnerability when using the AttributesExtension with untrusted user input.
Added
- Added
attributes/allowconfig option to specify which attributes users are allowed to set on elements (default allows virtually all attributes)
Changed
- The
AttributesExtensionblocks all attributes starting withonunless explicitly allowed via theattributes/allowconfig option - The
allow_unsafe_linksoption is now respected by theAttributesExtensionwhen users specifyhrefandsrcattributes
2.6.2 - 2025-04-18
Fixed
- Fixed Attributes extension parsing regression (#1071)
Other Changes
- fix incorrect interface in docs v2.6 by @CharrafiMed in https://github.com/thephpleague/commonmark/pull/1063
- docs/2.6/extensions/front-matter.md: add missing newline by @DanielEScherzer in https://github.com/thephpleague/commonmark/pull/1069
New Contributors
- @CharrafiMed made their first contribution in https://github.com/thephpleague/commonmark/pull/1063
- @DanielEScherzer made their first contribution in https://github.com/thephpleague/commonmark/pull/1069
Full Changelog: https://github.com/thephpleague/commonmark/compare/2.6.1…2.6.2
2.6.1 - 2024-12-29
Fixed
- Rendered list items should only add newlines around block-level children (#1059, #1061)
Full Changelog: https://github.com/thephpleague/commonmark/compare/2.6.0…2.6.1
2.6.0 - 2024-12-07
This is a security release to address potential denial of service attacks when parsing specially crafted, malicious input from untrusted sources (like user input). See https://github.com/thephpleague/commonmark/security/advisories/GHSA-c2pc-g5qf-rfrf for more details.
Added
- Added
max_delimiters_per_lineconfig option to prevent denial of service attacks when parsing malicious input - Added
table/max_autocompleted_cellsconfig option to prevent denial of service attacks when parsing large tables - The
AttributesExtensionnow supports attributes without values (#985, #986) - The
AutolinkExtensionexposes two new configuration options to override the default behavior (#969, #987):autolink/allowed_protocols- an array of protocols to allow autolinking forautolink/default_protocol- the default protocol to use when none is specified
- Added
RegexHelper::isWhitespace()method to check if a given character is an ASCII whitespace character - Added
CacheableDelimiterProcessorInterfaceto ensure linear complexity for dynamic delimiter processing - Added
Bracketdelimiter type to optimize bracket parsing
Changed
[and]are no longer added asDelimiterobjects on the stack; a newBrackettype with its own stack is used insteadUrlAutolinkParserno longer parses URLs with more than 127 subdomains- Expanded reference links can no longer exceed 100kb, or the size of the input document (whichever is greater)
- Delimiters should always provide a non-null value via
DelimiterInterface::getIndex()- We’ll attempt to infer the index based on surrounding delimiters where possible
- The
DelimiterStacknow accepts integer positions for any$stackBottomargument - Several small performance optimizations
2.5.3 - 2024-08-16
Changed
- Made compatible with CommonMark spec 0.31.1, including:
- Remove
source, addsearchto list of recognized block tags
- Remove
Full Changelog: https://github.com/thephpleague/commonmark/compare/2.5.2…2.5.3
2.5.2 - 2024-08-14
Changed
- Boolean attributes now require an explicit
truevalue (#1040)
Fixed
- Fixed regression where text could be misinterpreted as an attribute (#1040)
Full Changelog: https://github.com/thephpleague/commonmark/compare/2.5.1…2.5.2
2.5.1 - 2024-07-24
Fixed
- Fixed attribute parsing incorrectly parsing mustache-like syntax (#1035)
- Fixed incorrect
Tablestart line numbers (#1037)
New Contributors
- @jasonvarga made their first contribution in https://github.com/thephpleague/commonmark/pull/1035
Full Changelog: https://github.com/thephpleague/commonmark/compare/2.5.0…2.5.1
2.5.0 - 2024-07-22
Added
- The
AttributesExtensionnow supports attributes without values (#985, #986) - The
AutolinkExtensionexposes two new configuration options to override the default behavior (#969, #987):autolink/allowed_protocols- an array of protocols to allow autolinking forautolink/default_protocol- the default protocol to use when none is specified
Changed
- Made compatible with CommonMark spec 0.31.0, including:
- Allow closing fence to be followed by tabs
- Remove restrictive limitation on inline comments
- Unicode symbols now treated like punctuation (for purposes of flankingness)
- Trailing tabs on the last line of indented code blocks will be excluded
- Improved HTML comment matching
Paragraphs only containing link reference definitions will be kept in the AST until theDocumentis finalized- (These were previously removed immediately after parsing the
Paragraph)
- (These were previously removed immediately after parsing the
Fixed
- Fixed list tightness not being determined properly in some edge cases
- Fixed incorrect ending line numbers for several block types in various scenarios
- Fixed lowercase inline HTML declarations not being accepted
New Contributors
- @svenluijten made their first contribution in https://github.com/thephpleague/commonmark/pull/986
Full Changelog: https://github.com/thephpleague/commonmark/compare/2.4.4…2.5.0
2.4.4 - 2024-07-22
Fixed
- Fixed SmartPunct extension changing already-formatted quotation marks (#1030)
Full Changelog: https://github.com/thephpleague/commonmark/compare/2.4.3…2.4.4
2.4.3 - 2024-07-22
Fixed
- Fixed the Attributes extension not supporting CSS level 3 selectors (#1013)
- Fixed
UrlAutolinkParserincorrectly parsing text containingwwwanywhere before an autolink (#1025)
New Contributors
- @nfreader made their first contribution in https://github.com/thephpleague/commonmark/pull/1016
- @macbookandrew made their first contribution in https://github.com/thephpleague/commonmark/pull/1025
- @xavierlacot made their first contribution in https://github.com/thephpleague/commonmark/pull/1013
Full Changelog: https://github.com/thephpleague/commonmark/compare/2.4.2…2.4.3
2.4.2 - 2024-02-02
Fixed
- Fixed declaration parser being too strict
FencedCodeRenderer: don’t addlanguage-to class if already prefixed
New Contributors
- @sergiy-petrov made their first contribution in https://github.com/thephpleague/commonmark/pull/997
- @clustermin made their first contribution in https://github.com/thephpleague/commonmark/pull/988
- @peter279k made their first contribution in https://github.com/thephpleague/commonmark/pull/996
Full Changelog: https://github.com/thephpleague/commonmark/compare/2.4.1…2.4.2
2.4.1 - 2023-08-30
Fixed
- Fixed
ExternalLinkProcessornot fully disabling therelattribute when configured to do so (#992)
2.4.0 - 2023-03-24
See the upgrading guide for more information about the exception-related changes
Added
- Added generic
CommonMarkExceptionmarker interface for all exceptions thrown by the library - Added several new specific exception types implementing that marker interface:
AlreadyInitializedExceptionInvalidArgumentExceptionIOExceptionLogicExceptionMissingDependencyExceptionNoMatchingRendererExceptionParserLogicException
- Added more configuration options to the Heading Permalinks extension (#939):
heading_permalink/apply_id_to_heading- Whentrue, theidattribute will be applied to the heading element itself instead of the<a>tagheading_permalink/heading_class- class to apply to the heading elementheading_permalink/insert- now acceptsnoneto prevent the creation of the<a>link
- Added new
table/alignment_attributesconfiguration option to control how table cell alignment is rendered (#959)
Changed
- Change several thrown exceptions from
RuntimeExceptiontoLogicException(or something extending it), including:CallbackGenerators that fail to set a URL or return an expected valueMarkdownParserwhen deactivating the last block parser or attempting to get an active block parser when they’ve all been closed- Adding items to an already-initialized
Environment - Rendering a
Nodewhen no renderer has been registered for it
HeadingPermalinkProcessornow throwsInvalidConfigurationExceptioninstead ofRuntimeExceptionwhen invalid config values are given.HtmlElement::setAttribute()no longer requires the second parameter for boolean attributes- Several small micro-optimizations
- Changed Strikethrough to only allow 1 or 2 tildes per the updated GFM spec
Fixed
- Fixed inaccurate
@throwsdocblocks throughout the codebase, includingConverterInterface,MarkdownConverter, andMarkdownConverterInterface.- These previously suggested that only
\RuntimeExceptions were thrown, which was inaccurate as\LogicExceptions were also possible.
- These previously suggested that only
Older Versions
Please see the full list of releases for the complete changelog.