I see that there is a Markdown CMarkdown class, but how to use it?
CMarkdown
There are no examples anywhere, and the methods are not self-evident.
Am I using it statically, like CHtml , or weird, like a widget?Or do I need init this somewhere like a model?
CHtml
init
You can use CMarkdown as a widget in this form:
$this->beginWidget('CMarkdown', array('purifyOutput'=>true)); echo $content; $this->endWidget();
When $ content contains Markdown syntax, it will be processed by widgets. The array contains values ββfor the public properties of CMarkdown. The properties are documented in the class reference .
CMarkdown is used in the Yii blog example and you will find it in this view file .
This works and is the easiest:
static function markdown( $str ) { $md = new CMarkdown; return $md->transform($str); }
Static function in the parent controller. Probably not the Yii path, but it's simple:
<?=self::markdown($post->body)?>
Source: https://habr.com/ru/post/886302/More articles:The relationship between parsing, highlighting and completion - language-designWCF, Unity: One-Time Teardown Instances - idisposableDb design for approving data updates - sqlHow to search through Excel file in C # - c #Changing the name of the downloaded file in CodeIgniter (periods and underscores) - filenamesHow to write a custom search provider for the Windows Explorer search user interface - windowshow to create header file and source file .ui file in Qtdesigner? - qtHow do you call a method from static main ()? - c #Inherit from the "Form", which has parameters - inheritanceHow SqlAlchemy handles a unique constraint in a table definition - uniqueAll Articles