From f8dbb2753bf048181dc1e7e4d6b31ed4943074eb Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 27 Jan 2025 07:49:44 +1100 Subject: [PATCH] Allow + to be in lists for markdown --- app/Services/Pdf/PdfBuilder.php | 10 +--------- app/Services/PdfMaker/PdfMakerUtilities.php | 9 +-------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/app/Services/Pdf/PdfBuilder.php b/app/Services/Pdf/PdfBuilder.php index 9f7a15d51a..4d15cd9061 100644 --- a/app/Services/Pdf/PdfBuilder.php +++ b/app/Services/Pdf/PdfBuilder.php @@ -2012,15 +2012,7 @@ class PdfBuilder $first_char = substr($trimmed, 0, 1); - if ( - $first_char === '#' || // Headers - $first_char === '>' || // Blockquotes - $first_char === '-' || // Lists - $first_char === '+' || // Lists - $first_char === '*' || // Lists/Bold - $first_char === '_' || // Italic - $first_char === '`' || // Code - $first_char === '[' || // Links + if (in_array($first_char, ['#', '>', '-', '+', '*', '_', '`', '[']) || // Markdown characters str_contains($trimmed, '**') // Bold (special case) ) { $contains_markdown = true; diff --git a/app/Services/PdfMaker/PdfMakerUtilities.php b/app/Services/PdfMaker/PdfMakerUtilities.php index 7c32bbfa88..5b833369d1 100644 --- a/app/Services/PdfMaker/PdfMakerUtilities.php +++ b/app/Services/PdfMaker/PdfMakerUtilities.php @@ -106,14 +106,7 @@ trait PdfMakerUtilities $first_char = substr($trimmed, 0, 1); if ( - $first_char === '#' || // Headers - $first_char === '>' || // Blockquotes - $first_char === '-' || // Lists - $first_char === '+' || // Lists - $first_char === '*' || // Lists/Bold - $first_char === '_' || // Italic - $first_char === '`' || // Code - $first_char === '[' || // Links + in_array($first_char, ['#', '>', '-', '+', '*', '_', '`', '[']) || // Markdown characters str_contains($trimmed, '**') // Bold (special case) ) { $contains_markdown = true;