REDROOM
PHP 8.3.31
Path:
Logout
Edit File
Size: 2.47 KB
Close
/home/getspomw/royalsquad.us/vendor/league/commonmark/src/Extension/CommonMark/Parser/Block/HeadingStartParser.php
Text
Base64
<?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\CommonMark\Parser\Block; use League\CommonMark\Parser\Block\BlockStart; use League\CommonMark\Parser\Block\BlockStartParserInterface; use League\CommonMark\Parser\Cursor; use League\CommonMark\Parser\MarkdownParserStateInterface; use League\CommonMark\Util\RegexHelper; class HeadingStartParser implements BlockStartParserInterface { public function tryStart(Cursor $cursor, MarkdownParserStateInterface $parserState): ?BlockStart { if ($cursor->isIndented() || ! \in_array($cursor->getNextNonSpaceCharacter(), ['#', '-', '='], true)) { return BlockStart::none(); } $cursor->advanceToNextNonSpaceOrTab(); if ($atxHeading = self::getAtxHeader($cursor)) { return BlockStart::of($atxHeading)->at($cursor); } $setextHeadingLevel = self::getSetextHeadingLevel($cursor); if ($setextHeadingLevel > 0) { $content = $parserState->getParagraphContent(); if ($content !== null) { $cursor->advanceToEnd(); return BlockStart::of(new HeadingParser($setextHeadingLevel, $content)) ->at($cursor) ->replaceActiveBlockParser(); } } return BlockStart::none(); } private static function getAtxHeader(Cursor $cursor): ?HeadingParser { $match = RegexHelper::matchFirst('/^#{1,6}(?:[ \t]+|$)/', $cursor->getRemainder()); if (! $match) { return null; } $cursor->advanceToNextNonSpaceOrTab(); $cursor->advanceBy(\strlen($match[0])); $level = \strlen(\trim($match[0])); $str = $cursor->getRemainder(); $str = \preg_replace('/^[ \t]*#+[ \t]*$/', '', $str); \assert(\is_string($str)); $str = \preg_replace('/[ \t]+#+[ \t]*$/', '', $str); \assert(\is_string($str)); return new HeadingParser($level, $str); } private static function getSetextHeadingLevel(Cursor $cursor): int { $match = RegexHelper::matchFirst('/^(?:=+|-+)[ \t]*$/', $cursor->getRemainder()); if ($match === null) { return 0; } return $match[0][0] === '=' ? 1 : 2; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 15
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
BlockQuoteParser.php
1.54 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
BlockQuoteStartParser.php
1.09 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FencedCodeParser.php
2.72 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
FencedCodeStartParser.php
1.22 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
HeadingParser.php
1.47 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
HeadingStartParser.php
2.47 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
HtmlBlockParser.php
2.24 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
HtmlBlockStartParser.php
2.08 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
IndentedCodeParser.php
2.10 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
IndentedCodeStartParser.php
1.18 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ListBlockParser.php
2.88 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ListBlockStartParser.php
5.45 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ListItemParser.php
2.36 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ThematicBreakParser.php
1.15 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ThematicBreakStartParser.php
1.24 KB
lrw-rw-rw-
2025-09-17 06:53:05
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).