Loading... ## Parsedown GitHub:<a href="https://github.com/erusev/parsedown" target="_blank">Parsedown</a> * 第一种方式 ``` <?php include 'Parsedown.php'; //引入解析 function md2html($title, $file) { echo '<!doctype html>'; echo '<html>'; echo '<head>'; echo '<meta charset = "utf-8">'; echo '<title>'.$title.'</title>'; echo '</head>'; echo '<body>'; $parser = new Parsedown(); $markdown = file_get_contents($file); echo $parser->text($markdown); echo '</body>'; echo '</html>'; } md2html('这是标题', '1.md'); //标题和MD文件 ?> ``` * 第二种方式 ``` <?php require_once "Parsedown.php"; //引入解析 $Parsedown = new Parsedown(); echo '<meta charset="utf-8">'; echo $Parsedown->text('www.9ywk.com <br/> > Parsedown # 一级标题 ## 二级标题 ### 三级标题 #### 四级标题 ##### 五级标题 ###### 六级标题 '); ?> ``` --- ## Marked.js GitHub:<a href="https://github.com/markedjs/marked/releases/" target="_blank">Marked.js</a> ``` <!doctype html> <html> <head> <meta charset="utf-8"/> <title>Marked in the browser</title> </head> <body> <div id="content"></div> <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> <script> document.getElementById('content').innerHTML = marked('# 一级\n\第二行 **加粗**\n\### marked.min.js'); </script> </body> </html> ``` 本文作者:博主玖月 文章标题:PHP解析MarkDown 百度收录:已收录,详情 本文地址:https://www.9ywk.com/278.html 版权说明:若无注明,本文皆为“玖月博客”原创,转载请保留文章出处。 © 允许规范转载 赞赏 如果觉得我的文章对你有用,请随意赞赏 ×Close 赞赏作者 扫一扫支付 支付宝支付 微信支付
看不懂
copy进去试试就晓得了
试试就逝世