## Parsedown GitHub:Parsedown * 第一种方式 ```php '; echo ''; echo ''; echo ''; echo ''.$title.''; echo ''; echo ''; $parser = new Parsedown(); $markdown = file_get_contents($file); echo $parser->text($markdown); echo ''; echo ''; } md2html('这是标题', '1.md'); //标题和MD文件 ?> ``` * 第二种方式 ```php '; echo $Parsedown->text('www.9ywk.com > Parsedown # 一级标题 ## 二级标题 ### 三级标题 #### 四级标题 ##### 五级标题 ###### 六级标题 '); ?> ``` --- ## Marked.js GitHub:Marked.js ```php Marked in the browser ``` ## Parsedown 自用 ```html '; echo ''; echo ''; echo ''; echo ''.$title.''; echo ''; echo ''; $parser = new Parsedown(); $markdown = file_get_contents($file); echo $parser->text($markdown); echo ''; echo ''; } md2html('title', 'url.md'); ?> Doc list ``` Loading... ## Parsedown GitHub:<a href="https://github.com/erusev/parsedown" target="_blank">Parsedown</a> * 第一种方式 ```php <?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 <?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> ```php <!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> ``` ## Parsedown 自用 ```html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/jiuyueidc/9ywk_com@web/Markdown/markdown.css"> </head> <body> <div class="wonderpen-page fixed-width"> <div id="wonderpen-content" class="wonderpen-content"> <div class="markdown-body align-null"> <?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('title', 'url.md'); ?> </div> </div> </div> <script type="text/javascript"> //外链target=_blank function add() { var all_a = document.getElementsByTagName("a"); host_url=window.location.host; for (var i = 0; i < all_a.length; i++) { var domain = all_a[i].href.split("/"); //以“/”进行分割 if (domain[2]!=host_url) { all_a[i].target = "_blank"; } } } add(); </script> <center><h1> <a href="/">Doc list</a> </h1></center> </body> </html> ``` © 允许规范转载
3 条评论
看不懂 ::huaji:huaji::
copy进去试试就晓得了 ::huaji:shounuehuaji::
试试就逝世 ::huaji:pangcihuaji::