24 lines
747 B
PHP
24 lines
747 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Controller\Blog\Api;
|
||
|
|
||
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||
|
use Symfony\Component\HttpFoundation\Response;
|
||
|
use Symfony\Component\Routing\Annotation\Route;
|
||
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
||
|
use App\Markdown\Parser\Comment as CommentParser;
|
||
|
use Symfony\Component\HttpFoundation\Request;
|
||
|
|
||
|
class CommentController extends AbstractController
|
||
|
{
|
||
|
/**
|
||
|
* @Route("/api/blog/comment/preview", name="api_blog_comment_preview", options={"expose"=true})
|
||
|
*/
|
||
|
public function preview(Request $request, CommentParser $parser): JsonResponse
|
||
|
{
|
||
|
return $this->json([
|
||
|
'render' => $parser->transformMarkdown($request->request->get('content')),
|
||
|
]);
|
||
|
}
|
||
|
}
|