public static function convert($content, $config = [], $smartyMode = self::SMARTYPANTS_ATTR_LONG_EM_DASH_SHORT_EN)
{
$module = Config::initModule(Module::classname());
$output = $content;
if (strlen($output) > 0) {
$mdConfig = empty($config['markdown']) ? [] : $config['markdown'];
$output = static::process($content, $mdConfig);
if ($module->smartyPants) {
$smConfig = empty($config['smarty']) ? [] : $config['smarty'];
$smarty = new SmartyPantsTypographer($smartyMode);
foreach ($smConfig as $name => $value) {
$smarty->{$name} = $value;
}
$output = $smarty->transform($output);
$cuConfig = empty($config['custom']) ? $module->customConversion : $config['custom'];
$output = static::customProcess($output, $cuConfig);
}
if (is_bool($module->smarty) && $module->smarty || (is_string($module->smarty) || is_callable($module->smarty)) && call_user_func($module->smarty, $module)) {
$smarty = new \Smarty();
if ($module->smartyYiiApp) {
$smarty->assign('app', Yii::$app);
}
if ($module->smartyYiiParams) {
$smarty->config_vars = Yii::$app->params;
}
$output = $smarty->fetch('string:' . $output, null, null, $module->smartyParams);
}
}
return $output;
}