CMarkdown and rendering the Markdown text.

I had a fun time trying to find out how to do this, so I am writing this so that others can find it. It might be simple for most, but for some odd reason it wasn’t for me.

The code can be found in the yiiBaseFolder\demos\blog\protected\views\post_view.php.

Post this bit into your own post_view.php to render the markdown text created by such editors as ddeditor, CKeditor, etc.




<div class="content">

        <?php

            $this->beginWidget('CMarkdown', array('purifyOutput'=>true));

            echo $data->content;

            $this->endWidget();

        ?>

    </div>