CMS 2.0
This commit is contained in:
11
vendor/league/commonmark/CHANGELOG.md
vendored
11
vendor/league/commonmark/CHANGELOG.md
vendored
@@ -6,6 +6,14 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi
|
||||
|
||||
## [Unreleased][unreleased]
|
||||
|
||||
## [2.8.0] - 2025-11-26
|
||||
|
||||
### Added
|
||||
- Added a new `HighlightExtension` for marking important text using `==` syntax (#1100)
|
||||
|
||||
### Fixed
|
||||
- Fixed `AutolinkExtension` incorrectly matching URLs after invalid `www.` prefix (#1095, #1103)
|
||||
|
||||
## [2.7.1] - 2025-07-20
|
||||
|
||||
### Changed
|
||||
@@ -709,7 +717,8 @@ No changes were introduced since the previous release.
|
||||
- Alternative 1: Use `CommonMarkConverter` or `GithubFlavoredMarkdownConverter` if you don't need to customize the environment
|
||||
- Alternative 2: Instantiate a new `Environment` and add the necessary extensions yourself
|
||||
|
||||
[unreleased]: https://github.com/thephpleague/commonmark/compare/2.7.1...HEAD
|
||||
[unreleased]: https://github.com/thephpleague/commonmark/compare/2.8.0...HEAD
|
||||
[2.8.0]: https://github.com/thephpleague/commonmark/compare/2.7.1...2.8.0
|
||||
[2.7.1]: https://github.com/thephpleague/commonmark/compare/2.7.0...2.7.1
|
||||
[2.7.0]: https://github.com/thephpleague/commonmark/compare/2.6.2...2.7.0
|
||||
[2.6.2]: https://github.com/thephpleague/commonmark/compare/2.6.1...2.6.2
|
||||
|
||||
7
vendor/league/commonmark/README.md
vendored
7
vendor/league/commonmark/README.md
vendored
@@ -100,11 +100,12 @@ See [our extension documentation](https://commonmark.thephpleague.com/extensions
|
||||
Custom parsers/renderers can be bundled into extensions which extend CommonMark. Here are some that you may find interesting:
|
||||
|
||||
- [Emoji extension](https://github.com/ElGigi/CommonMarkEmoji) - UTF-8 emoji extension with Github tag.
|
||||
- [Sup Sub extensions](https://github.com/OWS/commonmark-sup-sub-extensions) - Adds support of superscript and subscript (`<sup>` and `<sub>` HTML tags)
|
||||
- [Sup Sub extensions](https://github.com/OWS/commonmark-sup-sub-extensions) - Adds support of superscript and subscript (`<sup>` and `<sub>` HTML tags).
|
||||
- [YouTube iframe extension](https://github.com/zoonru/commonmark-ext-youtube-iframe) - Replaces youtube link with iframe.
|
||||
- [Lazy Image extension](https://github.com/simonvomeyser/commonmark-ext-lazy-image) - Adds various options for lazy loading of images.
|
||||
- [Marker Extension](https://github.com/noah1400/commonmark-marker-extension) - Adds support of highlighted text (`<mark>` HTML tag)
|
||||
- [Pygments Highlighter extension](https://github.com/DanielEScherzer/commonmark-ext-pygments-highlighter) - Adds support for highlighting code with the Pygments library
|
||||
- [Marker Extension](https://github.com/noah1400/commonmark-marker-extension) - Adds support of highlighted text (`<mark>` HTML tag).
|
||||
- [Pygments Highlighter extension](https://github.com/DanielEScherzer/commonmark-ext-pygments-highlighter) - Adds support for highlighting code with the Pygments library.
|
||||
- [LatexRenderer extension](https://github.com/samwilson/commonmark-latex) - For rendering Markdown to LaTeX.
|
||||
|
||||
Others can be found on [Packagist under the `commonmark-extension` package type](https://packagist.org/packages/league/commonmark?type=commonmark-extension).
|
||||
|
||||
|
||||
2
vendor/league/commonmark/composer.json
vendored
2
vendor/league/commonmark/composer.json
vendored
@@ -116,7 +116,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "2.8-dev"
|
||||
"dev-main": "2.9-dev"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
|
||||
@@ -23,7 +23,7 @@ final class UrlAutolinkParser implements InlineParserInterface
|
||||
private const ALLOWED_AFTER = [null, ' ', "\t", "\n", "\x0b", "\x0c", "\x0d", '*', '_', '~', '('];
|
||||
|
||||
// RegEx adapted from https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Validator/Constraints/UrlValidator.php
|
||||
private const REGEX = '~
|
||||
private const REGEX = '~^
|
||||
(
|
||||
# Must start with a supported scheme + auth, or "www"
|
||||
(?:
|
||||
|
||||
26
vendor/league/commonmark/src/Extension/Highlight/HighlightExtension.php
vendored
Normal file
26
vendor/league/commonmark/src/Extension/Highlight/HighlightExtension.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the league/commonmark package.
|
||||
*
|
||||
* (c) Colin O'Dell <colinodell@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace League\CommonMark\Extension\Highlight;
|
||||
|
||||
use League\CommonMark\Environment\EnvironmentBuilderInterface;
|
||||
use League\CommonMark\Extension\ExtensionInterface;
|
||||
|
||||
class HighlightExtension implements ExtensionInterface
|
||||
{
|
||||
public function register(EnvironmentBuilderInterface $environment): void
|
||||
{
|
||||
$environment->addDelimiterProcessor(new MarkDelimiterProcessor());
|
||||
$environment->addRenderer(Mark::class, new MarkRenderer());
|
||||
}
|
||||
}
|
||||
39
vendor/league/commonmark/src/Extension/Highlight/Mark.php
vendored
Normal file
39
vendor/league/commonmark/src/Extension/Highlight/Mark.php
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the league/commonmark package.
|
||||
*
|
||||
* (c) Colin O'Dell <colinodell@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace League\CommonMark\Extension\Highlight;
|
||||
|
||||
use League\CommonMark\Node\Inline\AbstractInline;
|
||||
use League\CommonMark\Node\Inline\DelimitedInterface;
|
||||
|
||||
final class Mark extends AbstractInline implements DelimitedInterface
|
||||
{
|
||||
private string $delimiter;
|
||||
|
||||
public function __construct(string $delimiter = '==')
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->delimiter = $delimiter;
|
||||
}
|
||||
|
||||
public function getOpeningDelimiter(): string
|
||||
{
|
||||
return $this->delimiter;
|
||||
}
|
||||
|
||||
public function getClosingDelimiter(): string
|
||||
{
|
||||
return $this->delimiter;
|
||||
}
|
||||
}
|
||||
69
vendor/league/commonmark/src/Extension/Highlight/MarkDelimiterProcessor.php
vendored
Normal file
69
vendor/league/commonmark/src/Extension/Highlight/MarkDelimiterProcessor.php
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the league/commonmark package.
|
||||
*
|
||||
* (c) Colin O'Dell <colinodell@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace League\CommonMark\Extension\Highlight;
|
||||
|
||||
use League\CommonMark\Delimiter\DelimiterInterface;
|
||||
use League\CommonMark\Delimiter\Processor\DelimiterProcessorInterface;
|
||||
use League\CommonMark\Node\Inline\AbstractStringContainer;
|
||||
|
||||
class MarkDelimiterProcessor implements DelimiterProcessorInterface
|
||||
{
|
||||
public function getOpeningCharacter(): string
|
||||
{
|
||||
return '=';
|
||||
}
|
||||
|
||||
public function getClosingCharacter(): string
|
||||
{
|
||||
return '=';
|
||||
}
|
||||
|
||||
public function getMinLength(): int
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function getDelimiterUse(DelimiterInterface $opener, DelimiterInterface $closer): int
|
||||
{
|
||||
if ($opener->getLength() > 2 && $closer->getLength() > 2) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($opener->getLength() !== $closer->getLength()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// $opener and $closer are the same length so we just return one of them
|
||||
return $opener->getLength();
|
||||
}
|
||||
|
||||
public function process(AbstractStringContainer $opener, AbstractStringContainer $closer, int $delimiterUse): void
|
||||
{
|
||||
$mark = new Mark(\str_repeat('=', $delimiterUse));
|
||||
|
||||
$next = $opener->next();
|
||||
while ($next !== null && $next !== $closer) {
|
||||
$tmp = $next->next();
|
||||
$mark->appendChild($next);
|
||||
$next = $tmp;
|
||||
}
|
||||
|
||||
$opener->insertAfter($mark);
|
||||
}
|
||||
|
||||
public function getCacheKey(DelimiterInterface $closer): string
|
||||
{
|
||||
return '=' . $closer->getLength();
|
||||
}
|
||||
}
|
||||
50
vendor/league/commonmark/src/Extension/Highlight/MarkRenderer.php
vendored
Normal file
50
vendor/league/commonmark/src/Extension/Highlight/MarkRenderer.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* This file is part of the league/commonmark package.
|
||||
*
|
||||
* (c) Colin O'Dell <colinodell@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace League\CommonMark\Extension\Highlight;
|
||||
|
||||
use League\CommonMark\Node\Node;
|
||||
use League\CommonMark\Renderer\ChildNodeRendererInterface;
|
||||
use League\CommonMark\Renderer\NodeRendererInterface;
|
||||
use League\CommonMark\Util\HtmlElement;
|
||||
use League\CommonMark\Xml\XmlNodeRendererInterface;
|
||||
|
||||
final class MarkRenderer implements NodeRendererInterface, XmlNodeRendererInterface
|
||||
{
|
||||
/**
|
||||
* @param Mark $node
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @psalm-suppress MoreSpecificImplementedParamType
|
||||
*/
|
||||
public function render(Node $node, ChildNodeRendererInterface $childRenderer): \Stringable
|
||||
{
|
||||
Mark::assertInstanceOf($node);
|
||||
|
||||
return new HtmlElement('mark', $node->data->get('attributes'), $childRenderer->renderNodes($node->children()));
|
||||
}
|
||||
|
||||
public function getXmlTagName(Node $node): string
|
||||
{
|
||||
return 'mark';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getXmlAttributes(Node $node): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user