Files
Wiki/index.html
T
2020-09-14 17:10:38 +02:00

84 lines
3.2 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 = /!\[\[([^\]]*\.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
);
});
}
]
};
</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>
<script src="//unpkg.com/mermaid/dist/mermaid.js"></script>
<script src="//unpkg.com/docsify-mermaid@latest/dist/docsify-mermaid.js">
<script>mermaid.initialize({ startOnLoad: true });</script>
</body>
</html>