Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/vendor/cebe/markdown/ |
Upload File : |
<?php /** * @copyright Copyright (c) 2014 Carsten Brandt * @license https://github.com/cebe/markdown/blob/master/LICENSE * @link https://github.com/cebe/markdown#readme */ namespace cebe\markdown; /** * Markdown parser for github flavored markdown. * * @author Carsten Brandt <mail@cebe.cc> */ class GithubMarkdown extends Markdown { // include block element parsing using traits use block\TableTrait; use block\FencedCodeTrait; // include inline element parsing using traits use inline\StrikeoutTrait; use inline\UrlLinkTrait; /** * @var boolean whether to interpret newlines as `<br />`-tags. * This feature is useful for comments where newlines are often meant to be real new lines. */ public $enableNewlines = false; /** * @inheritDoc */ protected $escapeCharacters = [ // from Markdown '\\', // backslash '`', // backtick '*', // asterisk '_', // underscore '{', '}', // curly braces '[', ']', // square brackets '(', ')', // parentheses '#', // hash mark '+', // plus sign '-', // minus sign (hyphen) '.', // dot '!', // exclamation mark '<', '>', // added by GithubMarkdown ':', // colon '|', // pipe ]; /** * Consume lines for a paragraph * * Allow headlines, lists and code to break paragraphs */ protected function consumeParagraph($lines, $current) { // consume until newline $content = []; for ($i = $current, $count = count($lines); $i < $count; $i++) { $line = $lines[$i]; if ($line === '' || ltrim($line) === '' || !ctype_alpha($line[0]) && ( $this->identifyQuote($line, $lines, $i) || $this->identifyFencedCode($line, $lines, $i) || $this->identifyUl($line, $lines, $i) || $this->identifyOl($line, $lines, $i) || $this->identifyHr($line, $lines, $i) ) || $this->identifyHeadline($line, $lines, $i)) { break; } elseif ($this->identifyCode($line, $lines, $i)) { // possible beginning of a code block // but check for continued inline HTML // e.g. <img src="file.jpg" // alt="some alt aligned with src attribute" title="some text" /> if (preg_match('~<\w+([^>]+)$~s', implode("\n", $content))) { $content[] = $line; } else { break; } } else { $content[] = $line; } } $block = [ 'paragraph', 'content' => $this->parseInline(implode("\n", $content)), ]; return [$block, --$i]; } /** * @inheritdocs * * Parses a newline indicated by two spaces on the end of a markdown line. */ protected function renderText($text) { if ($this->enableNewlines) { $br = $this->html5 ? "<br>\n" : "<br />\n"; return strtr($text[1], [" \n" => $br, "\n" => $br]); } else { return parent::renderText($text); } } }