Beispiel #1
0
 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]);
 }
 /**
  * @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);
 }
 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']);
 }
Beispiel #4
0
 /**
  * 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);
 }
 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;
 }
 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;
 }
Beispiel #7
0
 /**
  * @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();
     }
 }
Beispiel #8
0
    /** 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');
    }
 public function parse($text)
 {
     $markdown = new MarkdownExtra();
     $text = $this->doShortcodes($text);
     $text = $markdown->transform($text);
     $text = $this->extendTags($text);
     return $text;
 }
Beispiel #10
0
 /**
  * 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);
 }
 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;
 }
Beispiel #12
0
 public function transform($text)
 {
     if ($this->running) {
         return parent::runBlockGamut($text);
     }
     $this->running = true;
     $text = parent::transform($text);
     $this->running = false;
     return $text;
 }
Beispiel #13
0
 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);
 }
Beispiel #14
0
 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);
     }
 }
Beispiel #15
0
 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);
     }
 }
Beispiel #16
0
 public function transform($text)
 {
     $parser = new MarkdownExtra();
     $stylesAdded = false;
     if (class_exists('Kadet\\Highlighter\\Language\\Language')) {
         $parser->code_block_content_func = function ($code, $language) use(&$stylesAdded) {
             if (!$stylesAdded) {
                 $this->pageStack->getPageResponse()->addCssFile('@Jarves/keylighter/default.scss');
                 $stylesAdded = true;
             }
             return Highlighter\highlight($code, Language::byName($language));
         };
     }
     return $parser->transform($text);
 }
 public function transform($text)
 {
     $this->no_markup = true;
     $this->no_entities = true;
     $text = preg_replace_callback(\thebuggenie\core\helpers\TextParser::getIssueRegex(), array($this, '_parse_issuelink'), $text);
     $text = parent::transform($text);
     $text = preg_replace_callback(\thebuggenie\core\helpers\TextParser::getMentionsRegex(), array($this, '_parse_mention'), $text);
     $text = preg_replace_callback(self::getStrikethroughRegex(), array($this, '_parse_strikethrough'), $text);
     $event = framework\Event::createNew('core', 'thebuggenie\\core\\framework\\helpers\\TextParserMarkdown::transform', $this);
     $event->trigger();
     foreach ($event->getReturnList() as $regex) {
         $text = preg_replace_callback($regex[0], $regex[1], $text);
     }
     return $text;
 }
Beispiel #18
0
 /**
  * A very simple markdown parser.
  *
  * @since 150424 Initial release.
  *
  * @param mixed $value Any input value.
  * @param array $args  Any additional behavioral args.
  *
  * @return string|array|object Html markup value(s).
  */
 public function __invoke($value, array $args = [])
 {
     if (is_array($value) || is_object($value)) {
         foreach ($value as $_key => &$_value) {
             $_value = $this->__invoke($_value, $args);
         }
         //unset($_key, $_value);
         return $value;
     }
     if (!($string = (string) $value)) {
         return $string;
         // Nothing to do.
     }
     $default_args = ['flavor' => 'markdown-extra', 'breaks' => true, 'anchorize' => false, 'anchor_rels' => [], 'no_p' => false];
     $args = array_merge($default_args, $args);
     $args = array_intersect_key($args, $default_args);
     $flavor = (string) $args['flavor'];
     $breaks = (bool) $args['breaks'];
     $no_p = (bool) $args['no_p'];
     $anchorize = (bool) $args['anchorize'];
     $anchor_rels = (array) $args['anchor_rels'];
     if ($flavor === 'parsedown-extra') {
         if (is_null($ParsedownExtra =& $this->cacheKey(__FUNCTION__, $flavor))) {
             $ParsedownExtra = new ParsedownExtra();
         }
         $ParsedownExtra->setBreaksEnabled($breaks);
         $string = $ParsedownExtra->text($string);
     } else {
         $flavor = 'markdown-extra';
         // Default flavor.
         if (is_null($MarkdownExtra =& $this->cacheKey(__FUNCTION__, $flavor))) {
             $MarkdownExtra = new MarkdownExtra();
             $MarkdownExtra->code_class_prefix = 'language-';
         }
         $string = $MarkdownExtra->transform($string);
     }
     if ($anchorize) {
         $string = $this->c::htmlAnchorize($string);
     }
     if ($anchor_rels) {
         $string = $this->c::htmlAnchorRels($string, $anchor_rels);
     }
     if ($no_p) {
         // Strip ` ^<p>|</p>$ ` tags?
         $string = preg_replace('/^\\s*(?:\\<p(?:\\s[^>]*)?\\>)+|(?:\\<\\/p\\>)+\\s*$/ui', '', $string);
     }
     return $string;
 }
function extract_content($src)
{
    $contents = file_get_contents($src);
    $metadata = ['timestamp' => filemtime($src)];
    if (preg_match("/<!--(.*)-->/s", $contents, $meta)) {
        $meta = trim($meta[1]);
        $meta = explode(PHP_EOL, $meta);
        foreach ($meta as $item) {
            $_md = explode(':', $item);
            $metadata[trim($_md[0])] = trim(implode(':', array_slice($_md, 1)));
        }
    }
    $contents = preg_replace('/<!--(.*)-->/Uis', '', $contents);
    $MarkdownParser = new MarkdownExtra();
    $content = $MarkdownParser->transform($contents);
    unset($contents);
    return array('metadata' => $metadata, 'content' => $content);
}
Beispiel #20
0
 /**
  * Format a block of text, using "Markdown".
  *
  * @param string $text
  *
  * @return string
  */
 public static function markdown($text)
 {
     $parser = new MarkdownExtra();
     $parser->empty_element_suffix = '>';
     $parser->no_markup = true;
     $text = $parser->transform($text);
     // HTMLPurifier needs somewhere to write temporary files
     $HTML_PURIFIER_CACHE_DIR = WT_DATA_DIR . 'html_purifier_cache';
     if (!is_dir($HTML_PURIFIER_CACHE_DIR)) {
         mkdir($HTML_PURIFIER_CACHE_DIR);
     }
     $config = HTMLPurifier_Config::createDefault();
     $config->set('Cache.SerializerPath', $HTML_PURIFIER_CACHE_DIR);
     $purifier = new HTMLPurifier($config);
     $text = $purifier->purify($text);
     return $text;
 }
Beispiel #21
0
 private function getPageInfo()
 {
     $_cont = model('WikiContent');
     $_tree = model('WikiTree');
     if (!empty($_GET['p'])) {
         $node = $_tree->get($_GET['p'], 'link')->get();
         if (empty($node)) {
             $file = WEBPATH . "/wiki/" . $_GET['p'] . '.md';
             if (!is_file($file)) {
                 $text = "您访问的页面不存在![点击跳转到首页](http://www.swoole.com/wiki/index/)";
             } else {
                 $text = file_get_contents($file);
             }
             goto markdown;
         }
         $wiki_id = $node['id'];
     } elseif (!empty($_GET['id'])) {
         $wiki_id = intval($_GET['id']);
     }
     $this->pageInfo = $_cont->get($wiki_id)->get();
     if (empty($this->pageInfo)) {
         $this->http->status(404);
         $this->http->finish("<h1>Page#{$wiki_id} Not Found.</h1>");
     }
     $this->nodeInfo = $_tree->get($wiki_id)->get();
     $text = $this->pageInfo['content'];
     $this->swoole->tpl->assign("id", $wiki_id);
     $this->swoole->tpl->assign("wiki_page", $this->pageInfo);
     markdown:
     //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;
     $html = $parser->transform($text);
     $this->swoole->tpl->assign("content", $html);
 }
 /**
  * {@inheritdoc}
  */
 public function transform($content)
 {
     return parent::transform($content);
 }
Beispiel #23
0
 /**
  * Parse content to Markdown
  * @param  string $str     String to parse
  * @param  array  $options Associative array containing options
  *                         - smartypants (TRUE/FALSE) enable or disable
  *                           smartypants
  *                         - no_markup (TRUE/FALSE) set to TRUE to disable
  *                           the parsing of markup in Markdown
  * @return string          Parsed Markdown content
  */
 public function markdown($str, $options = array())
 {
     // Ignore [code]
     $code_blocks = array();
     preg_match_all('/\\<div class="codeblock">(.*?)\\<\\/div>/uis', $str, $matches);
     foreach ($matches[0] as $match) {
         $hash = random_string('md5');
         $code_blocks[$hash] = $match;
         $str = str_replace($match, $hash, $str);
     }
     $parser = new MarkdownExtra();
     // Disable other markup if this is set
     if (isset($options['no_markup']) && get_bool_from_string($options['no_markup'])) {
         $parser->no_markup = TRUE;
     }
     // Protect any quotes in EE tags from the Markdown and SmartyPants
     // processors.
     $str = $this->protect_quotes_in_tags($str);
     // Parse the Markdown
     $str = $parser->transform($str);
     // Run everything through SmartyPants
     if (!isset($options['smartypants']) or get_bool_from_string($options['smartypants']) == TRUE) {
         if (!class_exists('SmartyPants_Parser')) {
             require_once APPPATH . 'libraries/typography/SmartyPants/smartypants.php';
         }
         // 2  ->  "---" for em-dashes; "--" for en-dashes
         $str = SmartyPants($str, 2);
     }
     // Restore the quotes we protected earlier.
     $str = $this->restore_quotes_in_tags($str);
     // Replace <div class="codeblock"> ([code]) blocks.
     foreach ($code_blocks as $hash => $code_block) {
         $str = str_replace($hash, $code_block, $str);
     }
     return $str;
 }
/**
 * Convert markdown
 */
function smarty_modifier_markdown($content)
{
    $parser = new MarkdownExtra();
    return $parser->transform($content);
}
Beispiel #25
0
 /**
  * Returns the readme for the package.
  *
  * @param mixed $default
  * @return string
  */
 public function getReadme($default = null)
 {
     try {
         $readme = $this->loader->getReadme($this);
         $parser = new MarkdownExtra();
         $parser->no_entities = true;
         $parser->no_markup = true;
         return $parser->transform($readme);
     } catch (LoadingException $e) {
         return $default;
     }
 }
 /**
  * {@inheritDoc}
  */
 public function transformMarkdown($text)
 {
     return parent::transform($text);
 }
 public function transformMarkdown($text, $appendHead = true)
 {
     $html = parent::transform($text);
     $html = $appendHead ? "{# \n This file is part of the Ngen - CSIRT Incident Report System.\n \n (c) CERT UNLP <*****@*****.**>\n \n This source file is subject to the GPL v3.0 license that is bundled\n with this source code in the file LICENSE.\n#}\n{% set father = 'CertUnlpNgenBundle:Incident:Report/Twig/BaseReport/baseReport.'~txtOrHtml~'.twig' %}\n{% extends father %}" . $html : $html;
     return $html;
 }
Beispiel #28
0
 /**
  * Display plugin manual/documentation
  *
  * @param	str	$addon	The name of plugin whose manual to display
  * @return	void
  */
 public function manual($addon)
 {
     $this->assertUserHasAccess($addon);
     try {
         $info = ee('Addon')->get($addon);
     } catch (\Exception $e) {
         show_error(lang('requested_module_not_installed') . NBS . $addon);
     }
     $readme_file = $info->getPath() . '/README.md';
     if (!file_exists($readme_file)) {
         show_404();
     }
     ee()->view->cp_page_title = $info->getName() . ' ' . lang('manual');
     $vars = array('name' => $info->getName(), 'version' => $this->formatVersionNumber($info->getVersion()), 'author' => $info->getAuthor(), 'author_url' => $info->get('author_url'), 'docs_url' => $info->get('docs_url'), 'description' => $info->get('description'));
     // Some pre-processing:
     //   1. Remove any #'s at the start of the doc, since that will be redundant with the add-on info
     $readme = preg_replace('/^\\s*#.*?\\n/s', '', file_get_contents($readme_file));
     $parser = new MarkdownExtra();
     $readme = $parser->transform($readme);
     // Some post-processing
     //   1. Step headers back (h2 becomes h1, h3 becomes, h2, etc.)
     //   2. Change codeblocks to textareas
     //   3. Add <mark> around h4's (params and variables)
     //   4. Pull out header tree for sidebar nav (h1 and h2 only)
     for ($i = 2, $j = 1; $i <= 6; $i++, $j++) {
         $readme = str_replace(array("<h{$i}>", "</h{$i}>"), array("<h{$j}>", "</h{$j}>"), $readme);
     }
     $pre_tags = array('<pre><code>', '</code></pre>', '<h4>', '</h4>');
     $post_tags = array('<textarea>', '</textarea>', '<h4><mark>', '</mark></h4>');
     $readme = str_replace($pre_tags, $post_tags, $readme);
     // [
     // 	[0] => <h1>full tag</h1>
     // 	[1] => 1
     // 	[2] => full tag
     // ]
     preg_match_all('|<h([12])>(.*?)</h\\1>|', $readme, $matches, PREG_SET_ORDER);
     $nav = array();
     $child = array();
     foreach ($matches as $key => $match) {
         // give 'em id's so they are linkable
         $new_header = "<h{$match[1]} id=\"ref{$key}\">{$match[2]}</h{$match[1]}>";
         // just in case they use the same name in multiple headers, we need to id separately
         // hence preg_replace() with a limit instead of str_replace()
         $readme = preg_replace('/' . preg_quote($match[0], '/') . '/', $new_header, $readme, 1);
         if ($match[1] == 1) {
             // append any children (h2's) if they exist
             if (!empty($child)) {
                 $nav[] = $child;
                 $child = array();
             }
             $nav[strip_tags($match[2])] = "#ref{$key}";
         } else {
             // save the children for later. SAVE THE CHILDREN!
             $child[strip_tags($match[2])] = "#ref{$key}";
         }
     }
     // don't forget the youngest!
     if (!empty($child)) {
         $nav[] = $child;
     }
     // Register our menu and header
     ee()->menu->register_left_nav($nav);
     ee()->view->header = array('title' => lang('addon_manager'), 'form_url' => ee('CP/URL')->make('addons'), 'search_button_value' => lang('search_addons_button'));
     $vars['readme'] = $readme;
     ee()->view->cp_heading = $vars['name'] . ' ' . lang('manual');
     ee()->view->cp_breadcrumbs = array(ee('CP/URL')->make('addons')->compile() => lang('addon_manager'));
     ee()->cp->render('addons/manual', $vars);
 }
Beispiel #29
0
require __DIR__ . DS . 'workers' . DS . 'Michelf' . DS . 'Markdown.php';
require __DIR__ . DS . 'workers' . DS . 'Michelf' . DS . 'MarkdownExtra.php';
// Re-write `Text::parse($input, '->html')` parser
Text::parser('to_html', function ($input) {
    if (!is_string($input)) {
        return $input;
    }
    global $config;
    $s = __DIR__ . DS . 'states' . DS;
    $url = File::open($s . 'url.txt')->read();
    $abbr = File::open($s . 'abbr.txt')->read();
    $parser = new MarkdownExtra();
    $parser->empty_element_suffix = ES;
    $parser->table_align_class_tmpl = 'text-%%';
    // table align class, example: `<td class="text-right">`
    return preg_replace(array('#<table>#', '#<a href="(?!javascript:|[./?\\#]|' . preg_quote($config->url, '/') . ')#'), array('<table class="table-bordered table-full-width">', '<a rel="nofollow" href="'), trim($parser->transform($url . "\n\n" . $abbr . "\n\n" . $input)));
});
function do_markdown($content, $results = array())
{
    global $config;
    $results = (object) $results;
    if (!isset($results->content_type) || $results->content_type === 'Markdown' || $results->content_type === 'Markdown Extra') {
        return Text::parse($content, '->html');
    }
    return $content;
}
// Apply `do_markdown` filter
Filter::add(array('content', 'message'), 'do_markdown', 1);
// Set new `html_parser` type
$config->html_parser->type = array_merge((array) $config->html_parser->type, array('Markdown' => 'Markdown Extra'));
// --ibid
Beispiel #30
0
 private function getMainData()
 {
     $_cont = model('WikiContent');
     $page_id = basename($_SERVER['REQUEST_URI'], '.html');
     if (is_numeric($page_id)) {
         $_GET['id'] = $page_id;
     }
     if (!empty($_GET['p'])) {
         $_tree = model('WikiTree');
         $node = $_tree->get($_GET['p'], 'link')->get();
         if (empty($node)) {
             $file = WEBPATH . "/wiki/" . $_GET['p'] . '.md';
             if (!is_file($file)) {
                 $text = "您访问的页面不存在![点击跳转到首页](http://www.swoole.com/wiki/index/)";
             } else {
                 $text = file_get_contents($file);
             }
             goto markdown;
         }
         $wiki_id = $node['id'];
     } elseif (!empty($_GET['id'])) {
         $wiki_id = intval($_GET['id']);
     } else {
         $wiki_id = $this->project['home_id'];
     }
     $wiki_page = $_cont->get($wiki_id)->get();
     $text = $wiki_page['content'];
     $this->swoole->tpl->assign("id", $wiki_id);
     $this->swoole->tpl->assign("wiki_page", $wiki_page);
     markdown:
     //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;
     $html = $parser->transform($text);
     $this->swoole->tpl->assign("content", $html);
 }