1 Star 0 Fork 3

未名/netnrmd

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
index.html 3.12 KB
一键复制 编辑 原始数据 按行查看 历史
netnr 提交于 2020-10-10 12:31 . 2.5.0
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<title>NetnrMD编辑器</title>
<meta name="keywords" content="netnr,NET牛人,markdown,NetnrMD,NetnrMD编辑器" />
<meta name="description" content="NetnrMD编辑器(jQuery + Monaco Editor 编辑器 + Marked 解析 + DOMPurify 清洗 + highlight 代码高亮)" />
</head>
<body>
<div>
<div id="editor">Loading ...</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/min/vs/loader.js"></script>
<link href="src/netnrmd.css" rel="stylesheet" />
<script src="src/netnrmd.js?20201010"></script>
<script src="src/netnrmd.extend.js?20201010"></script>
<script>
require.config({
paths: {
vs: "https://cdn.jsdelivr.net/npm/[email protected]/min/vs"
},
'vs/nls': { availableLanguages: { '*': 'zh-cn' } },
mdrely: [
'https://cdn.jsdelivr.net/npm/[email protected]/lib/marked.min',
'https://cdn.jsdelivr.net/npm/[email protected]/dist/purify.min',
'https://cdn.jsdelivr.net/npm/[email protected]/lib/highlight.min',
'vs/editor/editor.main'
]
});
require(require.getConfig().mdrely, function (m, p, h) {
window.marked = m;
window.DOMPurify = p;
window.hljs = h;
//初始化
window.nmd = new netnrmd('#editor', {
//加载扩展功能(可选)
//渲染前回调
viewbefore: function () {
this.items.splice(14, 0, netnrmd.extend.upload.button);
this.items.splice(15, 0, netnrmd.extend.import.button);
this.items.splice(17, 0, netnrmd.extend.about.button);
this.items.splice(0, 0, netnrmd.extend.emoji.button);
},
//命令回调
cmdcallback: function (cmd) {
switch (cmd) {
case "about":
case "emoji":
case "upload":
case "import":
netnrmd.extend[cmd].action(this)
break;
}
}
});
//加载默认值
var lsmd = localStorage.getItem("netnrmd_markdown");
if (!(lsmd && lsmd.trim() != "")) {
$.get('README_zh-CN.md', null, function (res) {
nmd.setmd(res);
})
}
//高度沉底
$(window).on('load resize', function () {
var vh = $(window).height() - nmd.obj.container.offset().top - 10;
nmd.height(Math.max(100, vh));
})
});
</script>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/phpu/netnrmd.git
[email protected]:phpu/netnrmd.git
phpu
netnrmd
netnrmd
master

搜索帮助