Inject CarveConverterInterface or CarveManager directly into your controllers and services.
use MarkupCarve\LaravelCarve\Service\CarveConverterInterface;
public function show(CarveConverterInterface $carve): View
{
$html = $carve->toHtml($content);
$text = $carve->toText($content);
}
# Welcome to Carve
This is a paragraph with /emphasis/, *strong*, _underline_ and /*both combined*/.
## Features
- Clean, consistent syntax
- Task lists: `[x]` done, `[-]` dropped, `[>]` deferred
- Much more!
> One syntax, one meaning - and the same HTML from every implementation.
^ The Carve design principles
### Code Example
```php
$html = $carve->toHtml('Hello *world*!');
```
Visit the [Carve organization](https://github.com/markup-carve) for more.
This is a paragraph with emphasis, strong, underline and both combined.
[x] done, [-] dropped, [>] deferredOne syntax, one meaning - and the same HTML from every implementation.
$html = $carve->toHtml('Hello *world*!');
Visit the Carve organization for more.
Welcome to Carve
This is a paragraph with emphasis, strong, underline and both combined.
Features
- Clean, consistent syntax
- Task lists: [x] done, [-] dropped, [>] deferred
- Much more!
"One syntax, one meaning - and the same HTML from every implementation."
The Carve design principles
Code Example
$html = $carve->toHtml('Hello *world*!');
Visit the Carve organization for more.
use MarkupCarve\LaravelCarve\Service\CarveManager;
public function show(CarveManager $manager): View
{
$html = $manager->toHtml($userContent, 'user_content');
}
## User Comment
This is /user submitted/ content.
It uses *safe mode* to prevent XSS:
<script>alert('xss')</script>
The script tag above will be escaped.
This is user submitted content.
It uses safe mode to prevent XSS:
<script>alert(‘xss’)</script>
The script tag above will be escaped.
// config/carve.php
return [
'converters' => [
'default' => [
'safe_mode' => false,
],
'user_content' => [
'safe_mode' => true,
],
],
'cache' => [
'enabled' => true,
'store' => null,
],
];