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


PHP Markdown::parse方法代码示例

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


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

示例1: get

 /**
  * Get the given documentation page.
  *
  * @param  string $manual
  * @param  string $version
  * @param  string $page
  * @return string
  */
 public function get($manual, $version, $page)
 {
     $pageFile = $this->storagePath . '/' . $manual . '/' . $version . '/' . $page . '.md';
     if ($this->files->exists($pageFile)) {
         return $this->cached("{$manual}.{$version}.{$pageFile}", Markdown::parse($this->files->get($pageFile), $manual . '/' . $version . '/' . dirname($page)));
     } else {
         App::abort(404);
     }
 }
开发者ID:nothing-fr,项目名称:legacy-codex,代码行数:17,代码来源:CodexRepositoryFlat.php

示例2: convert_raw_bodys

 public static function convert_raw_bodys($news_list)
 {
     if (!is_array($news_list)) {
         $news = (array) $news_list;
     }
     if (!$news_list) {
         return $news_list;
     }
     $raw_bodys = array();
     foreach ($news_list as $news) {
         $body = $news->body;
         if ($news->format == 2) {
             $body = \Markdown::parse($body);
         }
         $raw_bodys[$news->id] = $body;
     }
     return $raw_bodys;
 }
开发者ID:uzura8,项目名称:flockbird,代码行数:18,代码来源:model.php

示例3: getContent

 /**
  * @return bool|string
  * @throws \SystemException
  */
 public function getContent()
 {
     switch ($this->popup->content_type) {
         case 'imageUrl':
             return "<img src='{$this->popup->content_image_url}'>";
             break;
         case 'imageUpload':
             return '<img src="' . MediaLibrary::instance()->getPathUrl($this->popup->content_image_upload) . '">';
             break;
         case 'page':
             /** @var Page $page */
             $page = Page::load(Theme::getActiveTheme(), $this->popup->content_page);
             $cms = new CmsController();
             return $cms->run($page->url)->getContent();
             break;
         case 'markdown':
             return \Markdown::parse($this->popup->content_markdown);
             break;
     }
 }
开发者ID:janusnic,项目名称:octobercms-popup,代码行数:24,代码来源:PopupHelper.php

示例4: convert_body_by_format

function convert_body_by_format($body, $format = 0, $truncate_width = 0, $read_more_uri = '')
{
    switch ($format) {
        case 1:
            // raw(html_editor)
            break;
        case 2:
            $body = Markdown::parse($body);
            // markdown
            break;
        default:
            $body = '';
            break;
    }
    if (!$truncate_width) {
        return $body;
    }
    $options = array('truncate_width' => $truncate_width, 'is_strip_tags' => true, 'nl2br' => false, 'url2link' => false, 'truncate_line' => 0);
    if ($read_more_uri) {
        $options['read_more_uri'] = $read_more_uri;
    }
    $handler = new Site_PostedBodyHandler($options);
    return $handler->convert($body);
}
开发者ID:uzura8,项目名称:flockbird,代码行数:24,代码来源:view.php

示例5: foreach

    ?>
" role="alert">
			<?php 
    echo $massage['content'];
    ?>
		</div>
		<?php 
}
?>

		
		<?php 
if (isset($article)) {
    ?>
		<?php 
    echo Markdown::parse($article['topic_body']);
    ?>
		<pre>
		<?php 
    print_r($article);
    ?>

		<?php 
}
?>

		<?php 
if (isset($image)) {
    ?>
		<?php 
    foreach ($image[0] as $key => $item) {
开发者ID:takawasitobi,项目名称:pembit,代码行数:31,代码来源:view.php

示例6: save

 public function save($id)
 {
     $setting = Setting::find($id);
     $setting->update(Input::all());
     $resolved_content = Markdown::parse(Input::get('content'));
     $setting->resolved_content = $resolved_content;
     $setting->save($id);
 }
开发者ID:jiangyukun,项目名称:jingou,代码行数:8,代码来源:AdminController.php

示例7: getMessageAttribute

 /**
  * Return the formatted message.
  *
  * @param string $value
  *
  * @return string
  */
 public function getMessageAttribute($value)
 {
     return \Markdown::parse($value);
 }
开发者ID:rafaelvieiras,项目名称:connect,代码行数:11,代码来源:Message.php

示例8: getHtmlContentAttribute

 /**
  * Get the html content of the document.
  *
  * @return string
  */
 public function getHtmlContentAttribute()
 {
     return \Markdown::parse($this->content);
 }
开发者ID:rafaelvieiras,项目名称:connect,代码行数:9,代码来源:ProjectPhaseDocumentComment.php

示例9: foreach

    foreach ($posts as $post) {
        ?>
		<article id="post-<?php 
        echo $post->id;
        ?>
" class="post-preview">
		    <a href="<?php 
        echo \Router::get('show_post', array('segment' => $post->slug));
        ?>
" >
                <h2><?php 
        echo $post->name;
        ?>
</h2>
                <p><?php 
        echo \Str::truncate(\Markdown::parse($post->content), \Config::get('application.truncate', 600));
        ?>
</p>
            </a>
            <small>
                <a href="<?php 
        echo \Router::get('show_post_category', array('category' => $post->category->slug));
        ?>
"><?php 
        echo $post->category->name;
        ?>
</a>,
                <?php 
        echo __('by');
        ?>
 <a href="<?php 
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:31,代码来源:list.php

示例10: update

 /**
  * Update the specified resource in storage.
  * PUT /article/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $rules = ['title' => 'required|max:100', 'content' => 'required', 'tags' => array('required', 'regex:/^\\w+$|^(\\w+,)+\\w+$/')];
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->passes()) {
         $article = Article::with('tags')->find($id);
         $article->update(Input::only('title', 'content'));
         $resolved_content = Markdown::parse(Input::get('content'));
         $article->resolved_content = $resolved_content;
         $tags = array_unique(explode(',', Input::get('tags')));
         if (str_contains($resolved_content, '<p>')) {
             $start = strpos($resolved_content, '<p>');
             $length = strpos($resolved_content, '</p>') - $start - 3;
             $article->summary = substr($resolved_content, $start + 3, $length);
         } elseif (str_contains($resolved_content, '</h')) {
             $start = strpos($resolved_content, '<h');
             $length = strpos($resolved_content, '</h') - $start - 4;
             $article->summary = substr($resolved_content, $start + 4, $length);
         }
         $article->save();
         foreach ($article->tags as $tag) {
             if (($index = array_search($tag->name, $tags)) !== false) {
                 unset($tags[$index]);
             } else {
                 $tag->count--;
                 $tag->save();
                 $article->tags()->detach($tag->id);
             }
         }
         foreach ($tags as $tagName) {
             $tag = Tag::whereName($tagName)->first();
             if (!$tag) {
                 $tag = Tag::create(array('name' => $tagName));
             }
             $tag->count++;
             $article->tags()->save($tag);
         }
         return Redirect::route('article.show', $article->id);
     } else {
         return Redirect::route('article.edit', $id)->withInput()->withErrors($validator);
     }
 }
开发者ID:sdlyhu,项目名称:laravel-blog-7-final,代码行数:49,代码来源:ArticleController.php

示例11: parse_markdown

 public static function parse_markdown($text)
 {
     $text = preg_replace('!\\[\\]\\((.+?)\\)!', '[$1]($1)', $text);
     return Markdown::parse(Security::xss_clean($text));
 }
开发者ID:sharkpp,项目名称:md-micro-wiki,代码行数:5,代码来源:page.php

示例12:

<div class="post_small_description">
   	<?php 
echo \Markdown::parse($post->small_description);
?>
</div>
开发者ID:vano00,项目名称:blog,代码行数:5,代码来源:small_description.php

示例13: __

?>
</h1>
    <p>
    	<small>
			<?php 
echo __('by');
?>
 <a href="<?php 
echo \Router::get('show_post_author', array('author' => $post->user->username));
?>
">
                <?php 
echo $post->user->username;
?>
</a> <?php 
echo __('on');
?>
 <em><?php 
echo date('d/m/Y', $post->created_at);
?>
</em>
		 </small>
	 </p>
    </div>

    <graph></graph>
    <?php 
echo $snippet == true ? \Str::truncate(\Markdown::parse($post->content), \Config::get('application.truncate', 400)) : \Markdown::parse($post->content);
?>

</article>
开发者ID:daniel-rodas,项目名称:rodasnet.com,代码行数:31,代码来源:show.php

示例14: __

echo $post->user->username;
?>
</a> <?php 
echo __('on');
?>
 <em><?php 
echo date('d/m/Y', $post->created_at);
?>
</em>
		 </small>
	 </p>
</div>

<article>
	<?php 
echo \Markdown::parse($post->content);
?>
</article>
<hr>

<section class="comments">
    <h3><?php 
echo __('frontend.comment-this-post');
?>
</h3>

    <?php 
echo \Form::open();
?>
        <div class="row">
            <div class="col-md-6">
开发者ID:wesleysaraujo,项目名称:fuelphp-blogMVC,代码行数:31,代码来源:show.php


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