packagist league/commonmark 0.19.0

latest releases: 2.8.0, 2.7.1, 2.7.0...
6 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()

Don't miss a new commonmark release

NewReleases is sending notifications on new releases.