md转html,用例见 marked.html
libs/marked.min.js
通过调用marked()
方法传入md
语法返回转换后的html
var html = marked('md语法');
插件包中包含以下四种主题,可以自己进行相应扩展
libs/theme/markdown.css
libs/theme/markdown-github.css
libs/theme/Solarized-dark.css
libs/theme/Solarized-light.css
<div id="content"></div>
<script src="libs/marked.min.js"></script>
<script>
var md = `
![logo](https://developer.yonyou.com/_next/image?url=%2Fimg%2Fcommon%2Flogo.png&w=384&q=75)
# YonBuiolder
### 低代码开发平台
###### 快速开发企业级应用程序
- 以跨平台开发技术
- 定制服务
- 行业数据库
- 低代码工具
- [官网地址](https://developer.yonyou.com/home)
---
`;
document.getElementById('content').innerHTML = marked(md);
</script>