From 01577aed1afdea713b6c316ddcee6272fbdb58d9 Mon Sep 17 00:00:00 2001 From: Tony Lea Date: Tue, 25 Jun 2024 13:53:17 -0400 Subject: [PATCH 1/3] Adding functionality to allow the Str::markdown() method to accept extensions. --- src/Illuminate/Support/Str.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index 98e447f31ae1..9e84b3cd73da 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -637,10 +637,16 @@ public static function words($value, $words = 100, $end = '...') * @param array $options * @return string */ - public static function markdown($string, array $options = []) + public static function markdown($string, array $options = [], array $extensions = []) { $converter = new GithubFlavoredMarkdownConverter($options); + $environment = $converter->getEnvironment(); + + foreach ($extensions as $extension) { + $environment->addExtension($extension); + } + return (string) $converter->convert($string); } From e27d667b332b5dc14b08c8e49fe2d00e5adc639b Mon Sep 17 00:00:00 2001 From: Tony Lea Date: Tue, 25 Jun 2024 13:55:49 -0400 Subject: [PATCH 2/3] Replace tab spacing --- src/Illuminate/Support/Str.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index 9e84b3cd73da..8fb350f623e6 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -641,11 +641,11 @@ public static function markdown($string, array $options = [], array $extensions { $converter = new GithubFlavoredMarkdownConverter($options); - $environment = $converter->getEnvironment(); + $environment = $converter->getEnvironment(); - foreach ($extensions as $extension) { - $environment->addExtension($extension); - } + foreach ($extensions as $extension) { + $environment->addExtension($extension); + } return (string) $converter->convert($string); } From a43c42727c1853ada8a2f86eb4d2335cadef9343 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 25 Jun 2024 23:22:53 +0200 Subject: [PATCH 3/3] Update Str.php --- src/Illuminate/Support/Str.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Illuminate/Support/Str.php b/src/Illuminate/Support/Str.php index 8fb350f623e6..c9082a8de161 100644 --- a/src/Illuminate/Support/Str.php +++ b/src/Illuminate/Support/Str.php @@ -635,6 +635,7 @@ public static function words($value, $words = 100, $end = '...') * * @param string $string * @param array $options + * @param array $extensions * @return string */ public static function markdown($string, array $options = [], array $extensions = [])