From ce78c1bc94982ba9d4d89be2f40526f2395210ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Mon, 9 Aug 2021 14:24:50 +0200 Subject: [PATCH] Process markdown if `process_markdown` is available --- app/Services/PdfMaker/PdfMakerUtilities.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Services/PdfMaker/PdfMakerUtilities.php b/app/Services/PdfMaker/PdfMakerUtilities.php index e437b5ad1e8b..7d3ddb3dae05 100644 --- a/app/Services/PdfMaker/PdfMakerUtilities.php +++ b/app/Services/PdfMaker/PdfMakerUtilities.php @@ -92,11 +92,13 @@ trait PdfMakerUtilities $contains_html = false; if ($child['element'] !== 'script') { - $child['content'] = $this->commonmark->convertToHtml($child['content'] ?? ''); + if (array_key_exists('process_markdown', $this->data) && $this->data['process_markdown']) { + $child['content'] = $this->commonmark->convertToHtml($child['content'] ?? ''); + } else { + $child['content'] = array_key_exists('content', $child) ? nl2br($child['content']) : ''; + } } - // $child['content'] = array_key_exists('content', $child) ? nl2br($child['content']) : ''; - if (isset($child['content'])) { if (isset($child['is_empty']) && $child['is_empty'] === true) { continue;