mirror of
https://github.com/getgrav/grav.git
synced 2025-02-20 19:56:53 +01:00
41 lines
953 B
PHP
41 lines
953 B
PHP
<?php
|
|
/**
|
|
* @package Grav.Common.Page
|
|
*
|
|
* @copyright Copyright (C) 2015 - 2018 Trilby Media, LLC. All rights reserved.
|
|
* @license MIT License; see LICENSE file for details.
|
|
*/
|
|
|
|
namespace Grav\Common\Page\Medium;
|
|
|
|
use Grav\Common\Markdown\Parsedown;
|
|
|
|
trait ParsedownHtmlTrait
|
|
{
|
|
/**
|
|
* @var \Grav\Common\Markdown\Parsedown
|
|
*/
|
|
protected $parsedown = null;
|
|
|
|
/**
|
|
* Return HTML markup from the medium.
|
|
*
|
|
* @param string $title
|
|
* @param string $alt
|
|
* @param string $class
|
|
* @param string $id
|
|
* @param bool $reset
|
|
* @return string
|
|
*/
|
|
public function html($title = null, $alt = null, $class = null, $id = null, $reset = true)
|
|
{
|
|
$element = $this->parsedownElement($title, $alt, $class, $id, $reset);
|
|
|
|
if (!$this->parsedown) {
|
|
$this->parsedown = new Parsedown(null, null);
|
|
}
|
|
|
|
return $this->parsedown->elementToHtml($element);
|
|
}
|
|
}
|