parsedown

markdown解析库js

淺唱寂寞╮ 提交于 2020-04-19 22:36:47
引入文件很小 https://github.com/chjj/marked 当我发现php的版本不支持复选框的时候,找到了js版本,这个版本兼容复选框 下载以后只需要那个marked.min.js 即可 <!doctype html> <html> <head> <meta charset="utf-8"/> <title>Marked in the browser</title> </head> <body> <div id="content"></div> <script src="marked.min.js"></script> <script> document.getElementById('content').innerHTML = marked('+ [x] Markdown \n\n+ [ ] JavaScript \n\n### Marked in the browser\n\nRendered by marked . *** \n\n#### Hi ni \n我经常去的几个网站[Google][1]、[Java-er.com][2]。\n[1]: http://www.google.com \n[2]: https://www.java-er.com '); </script> </body> </html> https://java-er.com/blog

php 解析markdown

浪尽此生 提交于 2020-04-18 20:31:54
https://java-er.com/blog/php-markdown/ https://parsedown.org/ 有人做好了,就一个文件,下载完毕拷贝走即可 thinkphp 引入这个文件类作为第三方类即可。 <?php require_once "Parsedown.php"; $Parsedown = new Parsedown(); echo '<meta charset="utf-8">'; echo $Parsedown->text('Hello Parsedown 解析器! <br/> 这是 H1 这是 H2 我经常去的几个网站 Google 、 Java-er.com 。 '); ?> 显示效果 ​ 来源: oschina 链接: https://my.oschina.net/u/4412419/blog/3274387

Parsedown, add sub/superscript

元气小坏坏 提交于 2019-12-11 08:12:24
问题 I am trying to add sub/superscript to Parsedown. Parsedown's functions seem like a jungle to me. I've been trying to understand it but have been unable to decipher it. Turning ~text~ into <sub>text</sub> seems to be more of a challenge than I'd thought. Wrapping my head around the structure of his code, is just something that I can't and any help would be extremely appreciated. 回答1: This is a very simple regex. Use: \~(.*)\~|\^\((.*)\) With the substitution <sub>\1\2</sub> There are two