当前位置: 首页>>代码示例>>PHP>>正文


PHP MarkdownExtra::transform方法代码示例

本文整理汇总了PHP中Michelf\MarkdownExtra::transform方法的典型用法代码示例。如果您正苦于以下问题:PHP MarkdownExtra::transform方法的具体用法?PHP MarkdownExtra::transform怎么用?PHP MarkdownExtra::transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Michelf\MarkdownExtra的用法示例。


在下文中一共展示了MarkdownExtra::transform方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderFullpage

 public function renderFullpage(AbstractMediaEntity $entity)
 {
     /* @var MarkdownEntity $entity */
     $raw = file_get_contents($entity->getPath());
     $rendered = $this->markdownExtraParser->transform($raw);
     return $this->renderEngine->render('CmfcmfMediaModule:MediaType/Markdown:Fullpage.html.twig', ['entity' => $entity, 'rendered' => $rendered, 'raw' => $raw]);
 }
开发者ID:shefik,项目名称:MediaModule,代码行数:7,代码来源:Markdown.php

示例2: block

 /**
  * @param string $text
  * @return string
  */
 public function block($text)
 {
     $pattern = '~<(code|pre)>(.+?)</\\1>|```php\\s(.+?)\\n```~s';
     $highlighted = preg_replace_callback($pattern, [$this, 'highlightCb'], $text);
     $text = $this->markdown->transform($highlighted);
     return trim($text);
 }
开发者ID:nunodotferreira,项目名称:ApiGen,代码行数:11,代码来源:MarkdownMarkup.php

示例3: parse

 private function parse($str)
 {
     if (!preg_match($this->regex, $str, $matches) === 1) {
         throw new \DomainException('Invalid markdown format');
     }
     $meta = trim($matches[2]) !== '' ? $this->yamlParser->parse(trim($matches[2])) : null;
     $str = ltrim($matches[4]);
     return new Post($meta['id'], $meta['title'], $meta['summary'], $this->markdownParser->transform($str), $meta['tags'], $meta['published'], $meta['modified']);
 }
开发者ID:jkhaled,项目名称:xtreamwayz.com,代码行数:9,代码来源:FilePostRepository.php

示例4: process

 /**
  * Converts markdown into HTML
  *
  * @param string $content
  * @param array $config
  * @return string
  */
 public static function process($content, $config = [])
 {
     if (static::$markdown === null) {
         static::$markdown = new MarkdownExtra();
     }
     foreach ($config as $name => $value) {
         static::$markdown->{$name} = $value;
     }
     return static::$markdown->transform($content);
 }
开发者ID:kangqf,项目名称:yii2-markdown,代码行数:17,代码来源:Markdown.php

示例5: transform

 public function transform($text)
 {
     $text = parent::transform($text);
     $text = preg_replace_callback(TBGTextParser::getIssueRegex(), array($this, '_parse_issuelink'), $text);
     $text = preg_replace_callback(TBGTextParser::getMentionsRegex(), array($this, '_parse_mention'), $text);
     return $text;
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:7,代码来源:TBGTextParserMarkdown.class.php

示例6: transform

 public function transform($text)
 {
     $text = parent::transform($text);
     $harusame = new \Denshoch\Harusame(array("autoTcy" => $this->autoTcy, "tcyDigit" => $this->tcyDigit, "autoTextOrientation" => $this->autoTextOrientation));
     $text = $harusame->transform($text);
     return $text;
 }
开发者ID:denshoch,项目名称:dendenmarkdown,代码行数:7,代码来源:DenDenMarkdown.php

示例7: escapeDescription

 /**
  * @param CollectionEntity|AbstractMediaEntity $entity
  *
  * @return string
  */
 public function escapeDescription($entity)
 {
     $description = $entity->getDescription();
     $strategy = null;
     $hookName = null;
     if ($entity instanceof CollectionEntity) {
         $strategy = \ModUtil::getVar('CmfcmfMediaModule', 'descriptionEscapingStrategyForCollection');
         $hookName = 'collections';
     } elseif ($entity instanceof AbstractMediaEntity) {
         $strategy = \ModUtil::getVar('CmfcmfMediaModule', 'descriptionEscapingStrategyForMedia');
         $hookName = 'media';
     } else {
         throw new \LogicException();
     }
     $eventName = "cmfcmfmediamodule.filter_hooks.{$hookName}.filter";
     $hook = new \Zikula_FilterHook($eventName, $description);
     $description = $this->hookDispatcher->dispatch($eventName, $hook)->getData();
     switch ($strategy) {
         case 'raw':
             return $description;
         case 'text':
             return htmlentities($description);
         case 'markdown':
             return $this->markdownExtra->transform($description);
         default:
             throw new \LogicException();
     }
 }
开发者ID:shefik,项目名称:MediaModule,代码行数:33,代码来源:TwigExtension.php

示例8: develop_public

    /** markdown格式接口 */
    public function develop_public()
    {
        $gData = checkData($_GET);
        $int_opt = $gData['int_opt'];
        if (!$int_opt) {
            ajaxReturn('非法操作[缺少必须参数]', 300);
        }
        //样式
        echo '<style>
            .markdown-here-wrapper h1{ font-size: 20px; font-weight:bold; margin-top: 10px;}
            .markdown-here-wrapper h2{ font-size: 18px; font-weight:bold; margin-top: 10px;}
            .markdown-here-wrapper h3{ font-size: 16px; font-weight:bold; margin-top: 10px;}
            .markdown-here-wrapper table{ border-collapse: collapse; border: 1px solid yellowgreen;}
            .markdown-here-wrapper th { vertical-align: baseline; border: 1px solid yellowgreen; font-weight:bold; font-size: 18px;}
            .markdown-here-wrapper td { vertical-align: middle; border: 1px solid yellowgreen; font-size: 18px;}
            .markdown-here-wrapper tr { border: 1px solid yellowgreen;}

            .markdown-here-wrapper p a{font-size: 16px;}
            </style>';
        $output = $text = file_get_contents(MODULE_PATH . 'develop_info/' . $int_opt . '.md');
        $parser = new MarkdownExtra();
        $my_html = $parser->transform($output);
        $this->s->assign('my_html', $my_html);
        $this->s->display('interface_admin/interface_list.html');
    }
开发者ID:bibyzhang,项目名称:produce_cms,代码行数:26,代码来源:develop_doc.php

示例9: parse

 public function parse($text)
 {
     $markdown = new MarkdownExtra();
     $text = $this->doShortcodes($text);
     $text = $markdown->transform($text);
     $text = $this->extendTags($text);
     return $text;
 }
开发者ID:Absolute-Software,项目名称:laravel-apidocu,代码行数:8,代码来源:Parser.php

示例10: parse

 /**
  * overload parse with the MarkdownExtra parser
  *
  * @param $data
  *
  * @return string
  */
 public function parse($data)
 {
     $parser = new MarkdownExtra();
     foreach ($this->config as $key => $value) {
         $parser->{$key} = $value;
     }
     return $parser->transform($data);
 }
开发者ID:patrova,项目名称:Phile,代码行数:15,代码来源:Markdown.php

示例11: transform

 public function transform($text)
 {
     $this->no_markup = true;
     $this->no_entities = true;
     $text = parent::transform($text);
     $text = preg_replace_callback(\thebuggenie\core\helpers\TextParser::getIssueRegex(), array($this, '_parse_issuelink'), $text);
     $text = preg_replace_callback(\thebuggenie\core\helpers\TextParser::getMentionsRegex(), array($this, '_parse_mention'), $text);
     return $text;
 }
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:9,代码来源:TextParserMarkdown.php

示例12: transform

 public function transform($text)
 {
     if ($this->running) {
         return parent::runBlockGamut($text);
     }
     $this->running = true;
     $text = parent::transform($text);
     $this->running = false;
     return $text;
 }
开发者ID:toiee,项目名称:haik-markdown,代码行数:10,代码来源:HaikMarkdown.php

示例13: parseMarkdown

 static function parseMarkdown($text)
 {
     //GitHub Code Parse
     $text = str_replace('```', '~~~', $text);
     $parser = new Michelf\MarkdownExtra();
     $parser->fn_id_prefix = "post22-";
     $parser->code_attr_on_pre = false;
     $parser->tab_width = 4;
     return $parser->transform($text);
 }
开发者ID:sunnycamel,项目名称:swoole.com,代码行数:10,代码来源:Api.php

示例14: test_custom_code

 public function test_custom_code()
 {
     $markdown = new MarkdownExtra();
     $markdown->custom_code_parser = function ($class, $code) {
         return '<' . $class . '>' . $code . '</' . $class . '>';
     };
     $tests = [["```..svg\n123123123\n```", "<svg>123123123\n</svg>\n"], ["#111\n```..svg\n123123123\n```", "<h1>111</h1>\n\n<svg>123123123\n</svg>\n"]];
     foreach ($tests as $v) {
         $ret = $markdown->transform($v[0]);
         $this->assertEquals($v[1], $ret);
     }
 }
开发者ID:snje1987,项目名称:markdown,代码行数:12,代码来源:Codeblock.php

示例15: test_TodoList

 public function test_TodoList()
 {
     $markdown = new MarkdownExtra();
     $markdown->custom_code_parser = function ($class, $code) {
         return '<' . $class . '>' . $code . '</' . $class . '>';
     };
     $tests = [["## aaa\n[] 1111", "<h2>aaa</h2>\n\n<p class=\"todo\"><input type=\"checkbox\" disabled=\"disabled\" />1111</p>"], ["[*] 2222", '<p class="todo"><input type="checkbox" disabled="disabled" checked="checked" />2222</p>'], ['[+]3333', '<p class="todo"><input type="checkbox" disabled="disabled" checked="checked" />3333</p>'], ['[ ]4444[111](https://www.baidu.com)', '<p class="todo"><input type="checkbox" disabled="disabled" />4444<a href="https://www.baidu.com">111</a></p>'], ['[-]55`abc`55', '<p class="todo"><input type="checkbox" disabled="disabled" />55<code>abc</code>55</p>'], ["## aaa\n() 1111", "<h2>aaa</h2>\n\n<p class=\"todo\"><input type=\"radio\" disabled=\"disabled\" />1111</p>"], ["(*) 2222", '<p class="todo"><input type="radio" disabled="disabled" checked="checked" />2222</p>'], ['(+)3333', '<p class="todo"><input type="radio" disabled="disabled" checked="checked" />3333</p>'], ['( )4444[111](https://www.baidu.com)', '<p class="todo"><input type="radio" disabled="disabled" />4444<a href="https://www.baidu.com">111</a></p>'], ['(-)55`abc`55', '<p class="todo"><input type="radio" disabled="disabled" />55<code>abc</code>55</p>']];
     foreach ($tests as $v) {
         $ret = $markdown->transform($v[0]);
         $this->assertEquals($v[1] . "\n", $ret);
     }
 }
开发者ID:snje1987,项目名称:markdown,代码行数:12,代码来源:TodoList.php


注:本文中的Michelf\MarkdownExtra::transform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。