Static preview. Server-backed interactions are available only in a local checkout.

Service Injection Demo

Inject CarveConverterInterface or CarveManager directly into your controllers and services.

Default Converter

use MarkupCarve\LaravelCarve\Service\CarveConverterInterface;

public function show(CarveConverterInterface $carve): View
{
    $html = $carve->toHtml($content);
    $text = $carve->toText($content);
}

Source

# 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.

toHtml() Output

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.

toText() Output

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.

Named Converter via CarveManager (Safe Mode)

use MarkupCarve\LaravelCarve\Service\CarveManager;

public function show(CarveManager $manager): View
{
    $html = $manager->toHtml($userContent, 'user_content');
}

Source (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.

Safe Mode Output

XSS Protected

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.

Configuration

// config/carve.php
return [
    'converters' => [
        'default' => [
            'safe_mode' => false,
        ],
        'user_content' => [
            'safe_mode' => true,
        ],
    ],
    'cache' => [
        'enabled' => true,
        'store' => null,
    ],
];