Skip to content

Commit 2b43a33

Browse files
committed
Created a markdown helper function to convert to html
1 parent 4154c73 commit 2b43a33

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

app/helpers.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
use League\CommonMark\Converter;
4+
35
if ( ! function_exists('app'))
46
{
57
/**
@@ -45,4 +47,22 @@ function view($view, array $parameters = [], array $mergeData = [])
4547
{
4648
return app('view')->make($view, $parameters, $mergeData);
4749
}
48-
}
50+
}
51+
52+
if( ! function_exists('markdown'))
53+
{
54+
/**
55+
* Load an instance of the LeagueMarkdown for Operations
56+
*
57+
* @param string $view
58+
* @param array $parameters
59+
* @param array $mergeData
60+
* @return \Illuminate\Contracts\View\View
61+
*/
62+
63+
function markdown($data)
64+
{
65+
return app(Converter::class)->convertToHtml($data);
66+
}
67+
68+
}

0 commit comments

Comments
 (0)