跟插件原理一样,只是在主题层实现,这里记录一下。在主题function.php文件下添加:/** * 主题插件 * * @package theme_plugin */ class theme_plugin{ public static function markdown($text){ require_once 'Parse.php'; //解析文件路径 return Parsedown::instance()->setBreaksEnabled(true)->text($text); } }PHPCopy在themeInit函数下添加:Typecho_Plugin::factory('Widget_Abstract_Contents')->markdown = ['theme_plugin', 'markdown']; Typecho_Plugin::factory('Widget_Abstract_Comments')->markdown = ['theme_plugin', 'markdown'];PHPCopy
为啥不折腾下呢
有主题,不想折腾