本文整理汇总了PHP中Michelf\Markdown::transform方法的典型用法代码示例。如果您正苦于以下问题:PHP Markdown::transform方法的具体用法?PHP Markdown::transform怎么用?PHP Markdown::transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Michelf\Markdown
的用法示例。
在下文中一共展示了Markdown::transform方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle the command.
*
* @param Markdown $markdown
*/
public function handle(Markdown $markdown)
{
$this->command->info(strip_tags($markdown->transform(file_get_contents(base_path('LICENSE.md')))));
if (!$this->command->confirm('Do you agree to the provided license and terms of service?')) {
$this->command->error('You must agree to the license and terms of service before continuing.');
exit;
}
}
示例2: getContentHtml
public function getContentHtml()
{
if ($this->codeType == 'html') {
return $this->ContentHtml = $this->content;
} else {
$md = new Markdown();
$md->no_markup = true;
$md->no_entities = true;
return $this->ContentHtml = $md->transform($this->content);
}
}
示例3: it_should_throw_an_exception_on_an_exception
public function it_should_throw_an_exception_on_an_exception(Markdown $markdown)
{
$markdown->transform('bar')->willThrow('Exception');
$this->shouldThrow('TheWilkyBarKid\\TextFilter\\Exception\\TextFilterFailedException')->during('filter', array('foo'));
}
示例4:
function it_parses_markdown(\Michelf\Markdown $markdown)
{
$markdown->transform('# Markdown')->shouldBeCalled()->willReturn('<h1>Markdown</h1>');
$this->beConstructedWith($markdown);
$this->parse('# Markdown')->shouldReturn('<h1>Markdown</h1>');
}
示例5: transform
/**
* {@inheritdoc}
*/
public function transform($content)
{
return parent::transform($content);
}
示例6: rendered
/**
* Return the rendered content.
*
* @return string
*/
public function rendered()
{
return $this->markdown->transform($this->object->getValue());
}
示例7: apply
public function apply($content)
{
// apply custom behaviour here
return parent::transform($content);
}
示例8: doFilter
protected function doFilter($text)
{
return $this->markdown->transform($text);
}
示例9: getHtml
/**
* Returns the parsed content as HTML
*
* @param string $content
*
* @return string
*/
public function getHtml($content)
{
return $this->markdown->transform($this->getContentPart($content, static::CONTENT));
}
示例10: parseLine
/**
* @param string $line
* @param array $args [optionally]
* @param array $options [optionally]
* @return mixed
*/
public function parseLine($line, array $args = [], array $options = [])
{
return $this->markdown->transform($line);
}
示例11: function
}
// Handle page inclusions `{% include page xxx %}`
$source = preg_replace_callback('!\\{%\\s+include\\s+page\\s+(' . GP_PAGE_REGEX . ')\\s+%\\}!', function ($m) {
return is_page($m[1]) ? get_page($m[1]) : $m[1];
}, $source);
// Convert integers in URLs to internal page links
$markdownParser = new Markdown();
$markdownParser->url_filter_func = function ($url) {
$m = array();
if (preg_match('!^\\s*(' . GP_PAGE_REGEX . ')\\s*$!', $url, $m)) {
$url = "../page/{$m[1]}";
}
return $url;
};
// Transform the markdown
$page = $markdownParser->transform($source);
// Transform page links
$page = preg_replace_callback('!page (' . GP_PAGE_REGEX . ')!', function ($m) {
if (is_page($m[1])) {
return '<a href="../page/' . $m[1] . '">' . $m[0] . '</a>';
} else {
return $m[0];
}
}, $page);
// Transform dialogue links `(xxx)> blablabla`
$page = preg_replace_callback('!\\s*\\((' . GP_PAGE_REGEX . ')\\)\\s*>\\s*(.+?)(</p>)?$!m', function ($m) use($id) {
if (is_page($m[1])) {
if ($m[1] != $id) {
return '> <a class="talk" href="../page/' . $m[1] . '">' . $m[2] . '</a><br>' . (isset($m[3]) ? '</p>' : '');
} else {
return '';