72 lines
2.5 KiB
HTML
72 lines
2.5 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>
|
|
window.$docsify = {
|
|
name: 'Knowledge Mint System',
|
|
repo: 'Mint-System/Knowledge',
|
|
loadNavbar: true,
|
|
logo: '/assets/logo.svg',
|
|
themeColor: '#0B9FA3',
|
|
plugins: [
|
|
function(hook, vm) {
|
|
hook.beforeEach(function(content) {
|
|
|
|
// convert wiki image links
|
|
const wikiImage = /!\[\[([^\]]*)\]\]/g
|
|
content = content.replace(wikiImage, '<img src="/assets/$1" \/>')
|
|
|
|
// convert wiki links
|
|
// [[href#anchor|title] -> <a href="href?id=anchor">title</a>
|
|
|
|
const link = /\[\[([^\]]*)\]\]/g
|
|
let 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
|
|
);
|
|
});
|
|
}
|
|
]
|
|
};
|
|
</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>
|