commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark and GFM specs.

BSD-3-CLAUSE License

Downloads
256.3M
Stars
2.7K
Committers
117

Bot releases are hidden (Show)

commonmark - 1.1.3

Published by colinodell almost 5 years ago

Fixed

  • Fixed link parsing edge case (#403)
commonmark - 1.2.1

Published by colinodell almost 5 years ago

Changed

  • Introduced several micro-optimizations, reducing the parse time by 8%
commonmark - 1.2.0

Published by colinodell almost 5 years ago

Changed

  • Removed URL decoding step before encoding (more performant and better matches the JS library)
  • Removed redundant token from HTML tag regex
commonmark - 1.1.2

Published by colinodell almost 5 years ago

Fixed

  • Fixed URL normalization not handling non-UTF-8 sequences properly (#395, #396)
commonmark - 1.1.1

Published by colinodell almost 5 years ago

Fixed

  • Fixed handling of link destinations with unbalanced unescaped parens
  • Fixed adding delimiters to stack which can neither open nor close a run
commonmark - 1.1.0

Published by colinodell almost 5 years ago

Added

  • Added a new Html5EntityDecoder class (#387)

Changed

  • Improved performance by 10% (#389)
  • Made entity decoding less memory-intensive (#386, #387)

Fixed

  • Fixed PHP 7.4 compatibility issues

Deprecated

  • Deprecated the Html5Entities class - use Html5EntityDecoder instead (#387)
commonmark - 1.0.0

Published by colinodell over 5 years ago

First stable release! 🎉

No code changes have been introduced since 1.0.0-rc1

commonmark - 1.0.0-rc1

Published by colinodell over 5 years ago

Added

  • Extracted a ReferenceMapInterface from the ReferenceMap class
  • Added optional ReferenceMapInterface parameter to the Document constructor

Changed

  • Replaced all references to ReferenceMap with ReferenceMapInterface
  • ReferenceMap::addReference() no longer returns $this

Fixed

  • Fixed bug where elements with content of "0" wouldn't be rendered (#376)
commonmark - 0.19.3

Published by colinodell over 5 years ago

Fixed

  • Fixed bug where elements with content of "0" wouldn't be rendered (#376)
commonmark - 1.0.0-beta4

Published by colinodell over 5 years ago

Added

  • Added event dispatcher functionality (#359, #372)

Removed

  • Removed DocumentProcessorInterface functionality in favor of event dispatching (#373)
commonmark - 1.0.0-beta3

Published by colinodell over 5 years ago

Changed

  • Made the Delimiter class final and extracted a new DelimiterInterface
    • Modified most external usages to use this new interface
  • Renamed three Delimiter methods:
    • getOrigDelims() renamed to getOriginalLength()
    • getNumDelims() renamed to getLength()
    • setNumDelims() renamed to setLength()
  • Made additional classes final:
    • DelimiterStack
    • ReferenceMap
    • ReferenceParser
  • Moved ReferenceParser into the Reference sub-namespace

Removed

  • Removed unused Delimiter methods:
    • setCanOpen()
    • setCanClose()
    • setChar()
    • setIndex()
    • setInlineNode()
  • Removed fluent interface from Delimiter (setter methods now have no return values)
commonmark - 1.0.0-beta2

Published by colinodell over 5 years ago

This beta release fixes a couple of items that were not addressed in the previous beta.

Changed

  • DelimiterProcessorInterface::process() will accept any type of AbstractStringContainer now, not just Text nodes
  • The Delimiter constructor, getInlineNode(), and setInlineNode() no longer accept generic Node elements - only AbstractStringContainers

Removed

  • Removed all deprecated functionality:
    • The safe option (use html_input and allow_unsafe_links options instead)
    • All deprecated RegexHelper constants
    • DocParser::getEnvironment() (you should obtain it some other way)
    • AbstractInlineContainer (use AbstractInline instead and make isContainer() return true)
commonmark - 1.0.0-beta1

Published by colinodell over 5 years ago

See the upgrading guide for additional information.

Added

  • Added proper support for delimiters, including custom delimiters
    • addDelimiterProcessor() added to ConfigurableEnvironmentInterface and Environment
  • Basic delimiters no longer need custom parsers - they'll be parsed automatically
  • Added new methods:
    • AdjacentTextMerger::mergeTextNodesBetweenExclusive()
    • CommonMarkConveter::getEnvironment()
    • Configuration::set()
  • Extracted some new interfaces from base classes:
    • DocParserInterface created from DocParser
    • ConfigurationInterface created from Configuration
    • ReferenceInterface created from Reference

Changed

  • Renamed several methods of the Configuration class:
    • getConfig() renamed to get()
    • mergeConfig() renamed to merge()
    • setConfig() renamed to replace()
  • Changed ConfigurationAwareInterface::setConfiguration() to accept the new ConfigurationInterface instead of the concrete class
  • Renamed the AdjoiningTextCollapser class to AdjacentTextMerger
    • Replaced its collapseTextNodes() method with the new mergeChildNodes() method
  • Made several classes final:
    • Configuration
    • DocParser
    • HtmlRenderer
    • InlineParserEngine
    • NodeWalker
    • Reference
    • All of the block/inline parsers and renderers
  • Reduced visibility of several internal methods to private:
    • DelimiterStack::findEarliest()
    • All protected methods in InlineParserEngine
  • Marked some classes and methods as @internal
  • ElementRendererInterface now requires a public renderInline() method; added this to HtmlRenderer
  • Changed InlineParserEngine::parse() to require an AbstractStringContainerBlock instead of the generic Node class
  • Un-deprecated the CommonmarkConverter::VERSION constant
  • The Converter constructor now requires an instance of DocParserInterface instead of the concrete DocParser
  • Changed Emphasis, Strong, and AbstractWebResource to directly extend AbstractInline instead of the (now-deprecated) intermediary AbstractInlineContainer class

Fixed

  • Fixed null errors when inserting sibling Nodes without parents
  • Fixed NodeWalkerEvent not requiring a Node via its constructor
  • Fixed Reference::normalizeReference() improperly converting to uppercase instead of performing proper Unicode case-folding
  • Fixed strong emphasis delimiters not being preserved when enable_strong is set to false (it now works identically to enable_em)

Deprecated

  • Deprecated DocParser::getEnvironment() (you should obtain it some other way)
  • Deprecated AbstractInlineContainer (use AbstractInline instead and make isContainer() return true)

Removed

  • Removed inline processor functionality now that we have proper delimiter support:
    • Removed addInlineProcessor() from ConfigurableEnvironmentInterface and Environment
    • Removed getInlineProcessors() from EnvironmentInterface and Environment
    • Removed EmphasisProcessor
    • Removed InlineProcessorInterface
  • Removed EmphasisParser now that we have proper delimiter support
  • Removed support for non-UTF-8-compatible encodings
    • Removed getEncoding() from ContextInterface
    • Removed getEncoding(), setEncoding(), and $encoding from Context
    • Removed getEncoding() and the second $encoding constructor param from Cursor
  • Removed now-unused methods
    • Removed DelimiterStack::getTop() (no replacement)
    • Removed DelimiterStack::iterateByCharacters() (use the new processDelimiters() method instead)
    • Removed the protected DelimiterStack::findMatchingOpener() method
commonmark - 0.19.2

Published by colinodell over 5 years ago

Fixed

  • Fixed bug where default values for nested configuration paths were inadvertently cast to strings
commonmark - 0.19.1

Published by colinodell over 5 years ago

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.)

Added

  • Added the missing addExtension() method to the new ConfigurableEnvironmentInterface

Fixed

  • Fixed extensions not being able to register other extensions
commonmark - 0.19.0

Published by colinodell over 5 years ago

The 50th release of league/commonmark is here! 🎉

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.

Added

  • The priority of parsers, processors, and renderers can now be set when add()ing them; you no longer need to rely on the order in which they are added
  • Added support for trying multiple parsers per block/inline
  • Extracted two new base interfaces from Environment:
    • EnvironmentInterface
    • ConfigurableEnvironmentInterface
  • Extracted a new AbstractStringContainerBlock base class and corresponding StringContainerInterface from AbstractBlock
  • Added Cursor::getEncoding() method
  • Added .phpstorm.meta.php file for better IDE code completion
  • Made some minor optimizations here and there

Changed

  • Pretty much everything now has parameter and return types (#346)
  • Attributes passed to HtmlElement will now be escaped by default
  • Environment is now a final class
  • Environment::getBlockRendererForClass() was replaced with Environment::getBlockRenderersForClass() (note the added s)
  • Environment::getInlineRendererForClass() was replaced with Environment::getInlineRenderersForClass() (note the added s)
  • The Environment::get____() methods now return an iterator instead of an array
  • Context::addBlock() no longer returns the same block instance you passed into the method, as this served no useful purpose
  • RegexHelper::isEscapable() no longer accepts null values
  • Node::replaceChildren() now accepts any type of iterable, not just arrays
  • Some block elements now extend AbstractStringContainerBlock instead of AbstractBlock
    • InlineContainerInterface now extends the new StringContainerInterface
    • The handleRemainingContents() method (formerly on AbstractBlock, now on AbstractStringContainerBlock) is now an `abstract method
    • The InlineParserContext constructor now requires an AbstractStringContainerBlock instead of an AbstractBlock

Removed

  • Removed support for PHP 5.6 and 7.0 (#346)
  • Removed support for add()ing parsers with just the target block/inline class name - you need to include the full namespace now
  • Removed the following unused methods from Environment:
    • getInlineParser($name)
    • getInlineParsers()
    • createInlineParserEngine()
  • Removed the unused getName() methods:
    • AbstractBlockParser::getName()
    • AbstractInlineParser::getName()
    • BlockParserInterface::getName()
    • InlinerParserInterface::getName()
  • Removed the now-useless classes:
    • AbstractBlockParser
    • AbstractInlinerParser
    • InlineContainer
  • Removed the AbstractBlock::acceptsLines() method
  • Removed the now-useless constructor from AbstractBlock
  • Removed previously-deprecated functionality:
    • InlineContainer class
    • RegexHelper::$instance
    • RegexHelper::getInstance()
    • RegexHelper::getPartialRegex()
    • RegexHelper::getHtmlTagRegex()
    • RegexHelper::getLinkTitleRegex()
    • RegexHelper::getLinkDestinationBracesRegex()
    • RegexHelper::getThematicBreakRegex()
  • Removed the second $preserveEntities parameter from Xml:escape()
commonmark - 0.18.5

Published by colinodell over 5 years ago

Fixed

  • Fixed the adjoining Text collapser not handling the full tree (thephpleague/commonmark-ext-autolink#10)
commonmark - 0.18.4

Published by colinodell over 5 years ago

Changed

  • Modified how URL normalization decodes certain characters in order to align with the JS library's output
  • Disallowed unescaped ( in parenthesized link title

Fixed

  • Fixed two exponential backtracking issues
commonmark - 0.18.3

Published by colinodell over 5 years ago

This is a security update release.

Changed

  • XML/HTML entities in attributes will no longer be preserved when rendering (#353)

Fixed

  • Fix XSS vulnerability caused by improper preservation of entities when rendering (#353)

Deprecated

  • Deprecated the $preserveEntites argument of Xml::escape() for removal in the next release (#353)
commonmark - 0.18.2

Published by colinodell over 5 years ago

Fixed

  • Fixed adjoining Text elements not being collapsed after delimiter processing

Deprecated

  • Deprecated the CommonmarkConverter::VERSION constant for removal in 1.0.0
Package Rankings
Top 0.11% on Packagist.org
Badges
Extracted from project README
Latest Version Total Downloads Software License Build Status Coverage Status Quality Score Psalm Type Coverage CII Best Practices Sponsor development of this project
Related Projects