ch1p_io_web/handler/admin/MarkdownPreview.php
Evgeny Zinoviev f7bfdf58de initial
2022-07-09 19:40:17 +03:00

22 lines
528 B
PHP

<?php
namespace handler\admin;
use Response;
class MarkdownPreview extends AdminRequestHandler {
public function post(): Response {
list($md, $title, $use_image_previews) = $this->input('md, title, b:use_image_previews');
$html = \markup::markdownToHtml($md, $use_image_previews);
$ctx = new \SkinContext('\\skin\\admin');
$html = $ctx->markdownPreview(
unsafe_html: $html,
title: $title
);
return new \AjaxOkResponse(['html' => $html]);
}
}