php集成Markdown 发表于 2017-04-01 更新于 2023-05-05 1.php安装markdown扩展1composer require michelf/php-markdown 2.php转化markdown为html12use \Michelf\MarkdownExtra;$my_html = MarkdownExtra::defaultTransform($my_text); 3.页面加入语法高亮插件highlight.js123<link rel="stylesheet" href="//cdn.bootcss.com/highlight.js/8.5/styles/default.min.css"><script src="//cdn.bootcss.com/highlight.js/8.5/highlight.min.js"></script><script>hljs.initHighlightingOnLoad();</script> 参考资料: php-markdown 语法高亮插件-highlightjs