本文整理汇总了PHP中Markdown::text方法的典型用法代码示例。如果您正苦于以下问题:PHP Markdown::text方法的具体用法?PHP Markdown::text怎么用?PHP Markdown::text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Markdown
的用法示例。
在下文中一共展示了Markdown::text方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generatePost
/**
* Generate a preview
*
* @param array $input
* @param $user
* @return \Illuminate\View\View
*/
public function generatePost($input, $user)
{
// Generate preview post
$post = $this->postRepo->getEmptyPost();
$post->author = $user;
$post->markdown = $input['content'];
$post->html = \Purifier::clean(\Markdown::text($input['content']));
return $post;
}
示例2: create
/**
* Create post
*
* @param array $input
* @param $topic
* @param $user
* @param bool $add
* @return \Illuminate\Http\RedirectResponse|object
*/
public function create($input, $topic, $user, $add = true)
{
// Create post
$data = ['markdown' => $input['content'], 'html' => \Purifier::clean(\Markdown::text($input['content'])), 'topic_id' => $topic->id, 'user_id' => $user->id];
if (\Bouncer::hasPermission('devresponse') and \Input::get('devresponse') == 1) {
$data['developer_response'] = true;
}
$post = $this->postRepo->create($data);
return $post;
}
示例3: testTablesHaveTableClass
public function testTablesHaveTableClass()
{
$parser = new Markdown();
$content = <<<'MARKDOWN'
|Tables|Is|
|------|--|
|OK |? |
MARKDOWN;
$result = $parser->text($content);
$this->assertEquals("<table class=\"table\">\n<thead>\n<tr>\n<th>Tables</th>\n<th>Is</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>OK</td>\n<td>?</td>\n</tr>\n</tbody>\n</table>", $result);
}
示例4: readDoc
protected function readDoc($fileName)
{
// Key for cache
$cacheKey = md5('docs.' . $fileName);
// use cache if exist
if ($this->cache->has($cacheKey)) {
return $this->cache->get($cacheKey);
}
$getContent = $this->file->get(base_path('docs/' . $fileName));
$doc = \Markdown::text($getContent);
// Put it in cache
$this->cache->put($cacheKey, $doc, 10080);
return $doc;
}
示例5: getBodyHtmlAttribute
public function getBodyHtmlAttribute($field)
{
return \Markdown::text($this->body);
}
示例6: render
/**
* @param string $input
* @return string HTML
*/
public static function render($input)
{
$md = new Markdown();
return preg_replace('/^<p>|<\\/p>$/', '', $md->text($input));
}
示例7: markdown_settings
function markdown_settings($filename)
{
return Markdown::text(settings($filename));
}
示例8:
<?php
preg_match('/^\\s*(#{1,})(.*)/m', $text, $title);
?>
<title><?php
echo $title[2];
?>
</title>
</head>
<body>
<?php
if (!preg_match('/index.md$/', $file)) {
?>
<div class="toc">
<?php
echo $instance->text(toc_file($file, FALSE));
?>
</div>
<?php
}
?>
<?php
echo $instance->text($text);
?>
<script src="<?php
echo $url;
?>
prism.js"></script>
</body>
</html>
示例9: edit
/**
* @param $postId
* @param $input
*/
public function edit($postId, $input)
{
// Edit post
$this->postRepo->edit($postId, ['markdown' => $input['content'], 'html' => \Purifier::clean(\Markdown::text($input['content']))]);
}