mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Process markdown on global level instead of line items
This commit is contained in:
parent
330adaaeb0
commit
3a30a527ed
@ -347,7 +347,7 @@ class Design extends BaseDesign
|
||||
|
||||
$items = $this->transformLineItems($this->entity->line_items, $type);
|
||||
|
||||
$this->processMarkdownOnLineItems($items);
|
||||
// $this->processMarkdownOnLineItems($items);
|
||||
|
||||
if (count($items) == 0) {
|
||||
return [];
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
namespace App\Services\PdfMaker;
|
||||
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
|
||||
class PdfMaker
|
||||
{
|
||||
use PdfMakerUtilities;
|
||||
@ -36,6 +38,9 @@ class PdfMaker
|
||||
|
||||
private $options;
|
||||
|
||||
/** @var CommonMarkConverter */
|
||||
protected $commonmark;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
@ -43,6 +48,10 @@ class PdfMaker
|
||||
if (array_key_exists('options', $data)) {
|
||||
$this->options = $data['options'];
|
||||
}
|
||||
|
||||
$this->commonmark = new CommonMarkConverter([
|
||||
'allow_unsafe_links' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
public function design(Design $design)
|
||||
|
@ -91,6 +91,10 @@ trait PdfMakerUtilities
|
||||
foreach ($children as $child) {
|
||||
$contains_html = false;
|
||||
|
||||
if ($child['element'] !== 'script') {
|
||||
$child['content'] = $this->commonmark->convertToHtml($child['content'] ?? '');
|
||||
}
|
||||
|
||||
if (isset($child['content'])) {
|
||||
if (isset($child['is_empty']) && $child['is_empty'] === true) {
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user