Skip to content

Commit

Permalink
Add Support for Extensions in Str::markdown Method (#51907)
Browse files Browse the repository at this point in the history
* Adding functionality to allow the Str::markdown() method to accept extensions.

* Replace tab spacing

* Update Str.php

---------

Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
tnylea and taylorotwell authored Jun 25, 2024
1 parent ef374db commit df7f734
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Illuminate/Support/Str.php
Original file line number Diff line number Diff line change
Expand Up @@ -635,12 +635,19 @@ 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 = [])
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);
}

Expand Down

0 comments on commit df7f734

Please sign in to comment.