本文整理汇总了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);
}
}
示例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;
}
示例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;
}
}
示例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);
}
示例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) {
示例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);
}
示例7: getMessageAttribute
/**
* Return the formatted message.
*
* @param string $value
*
* @return string
*/
public function getMessageAttribute($value)
{
return \Markdown::parse($value);
}
示例8: getHtmlContentAttribute
/**
* Get the html content of the document.
*
* @return string
*/
public function getHtmlContentAttribute()
{
return \Markdown::parse($this->content);
}
示例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
示例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);
}
}
示例11: parse_markdown
public static function parse_markdown($text)
{
$text = preg_replace('!\\[\\]\\((.+?)\\)!', '[$1]($1)', $text);
return Markdown::parse(Security::xss_clean($text));
}
示例12:
<div class="post_small_description">
<?php
echo \Markdown::parse($post->small_description);
?>
</div>
示例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>
示例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">