Is it possible to access twig filters in a plugin? I want to be able to preview how text will look in a textarea using Markdown for a discussion board, it'd be awesome to use ajax to send the content to the controller then return the filtered version for preview, something like:
public function actionPreviewContentAjax()
{
$this->requireAjaxRequest();
$content = craft()->request->getPost('textarea_content');
// somehow apply twig's "| markdown" filter to $content
$this->returnJson( $content );
}
Is twig accessible in this manner or am I out of my mind? :X