105 lines
3.6 KiB
HTML
105 lines
3.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Document</title>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
|
|
<meta name="description" content="Description">
|
|
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
|
|
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/lib/themes/vue.css">
|
|
</head>
|
|
|
|
<body>
|
|
<div id="app"></div>
|
|
<script src="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
|
<script type="text/javascript" src="paths.js"></script>
|
|
<script>
|
|
var num = 0;
|
|
mermaid.initialize({ startOnLoad: false })
|
|
|
|
window.$docsify = {
|
|
name: 'Knowledge Mint System',
|
|
repo: 'Mint-System/Knowledge',
|
|
loadNavbar: true,
|
|
loadSidebar: false,
|
|
logo: '/assets/logo.svg',
|
|
themeColor: '#0B9FA3',
|
|
auto2top: true,
|
|
search: {
|
|
paths: paths
|
|
},
|
|
plugins: [
|
|
function (hook, vm) {
|
|
hook.beforeEach(function (content) {
|
|
|
|
// convert wiki image links
|
|
const wikiImage = /!\[\[([^\]]*\.png|jpg|jpeg)\]\]/g
|
|
content = content.replace(wikiImage, '<img src="/assets/$1" \/>')
|
|
|
|
// convert embeded content links
|
|
// ![[Content] -> [Content](Content.md ':include')
|
|
const embededContent = /!\[\[([^\]]*)\]\]/g
|
|
let matches = content.match(embededContent) || []
|
|
for (i = 0; i < matches.length; i++) {
|
|
let match = matches[i]
|
|
let title = encodeURI(match.match(/\[\[([^\]|#]*)/)[1])
|
|
content = content.replace(embededContent, `[$1](${title}.md ':include')`)
|
|
}
|
|
|
|
// convert wiki links
|
|
// [[href#anchor|title] -> <a href="href?id=anchor">title</a>
|
|
const link = /\[\[([^\]]*)\]\]/g
|
|
matches = content.match(link) || []
|
|
for (i = 0; i < matches.length; i++) {
|
|
|
|
let match = matches[i]
|
|
let href = match.match(/\[\[([^\]|#]*)/)[1]
|
|
let title = match.match(/\[\[([^\]|#]*)/)[1]
|
|
let anchor
|
|
|
|
if (match.indexOf('#') > 0) {
|
|
anchor = match.match(/#([^\||\]]*)/)[1]
|
|
// Convert to docsify id
|
|
anchor = anchor.toLowerCase().replace(/ /g, "-")
|
|
}
|
|
|
|
if (match.indexOf('|') > 0) {
|
|
href = match.match(/\[\[([^\||#]*)/)[1]
|
|
title = match.match(/\|(.*)\]\]/)[1]
|
|
}
|
|
|
|
content = content.replace(match, `<a href="/#/${href ? href : vm.route.file.replace('\.md', '')}${anchor ? ('?id=' + anchor) : ''}">${title}</a>`)
|
|
}
|
|
|
|
// add edit button
|
|
var url = 'https://github.com/Mint-System/Knowledge/blob/master/' + vm.route.file
|
|
var edit = '[📝 Edit Document](' + url + ')\n'
|
|
|
|
return (
|
|
content +
|
|
'\n\n' +
|
|
edit
|
|
);
|
|
});
|
|
}
|
|
],
|
|
markdown: {
|
|
renderer: {
|
|
code: function (code, lang) {
|
|
if (lang === "mermaid") {
|
|
return (
|
|
'<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + "</div>"
|
|
);
|
|
}
|
|
return this.origin.code.apply(this, arguments)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.min.js"></script>
|
|
<script src="//cdn.jsdelivr.net/npm/docsify/lib/plugins/search.min.js"></script>
|
|
</body>
|
|
|
|
</html> |