-
Notifications
You must be signed in to change notification settings - Fork 6
/
index.html
113 lines (106 loc) · 4.67 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>dat-workshop</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="A hands-on introduction to creating decentralized apps using Dat. By GEUT">
<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="//unpkg.com/docsify/lib/themes/vue.css">
</head>
<body>
<div id="app"></div>
<script>
window.$docsify = {
name: 'dat-workshop',
repo: 'https://github.com/geut/dat-workshop',
auto2top: true,
loadSidebar: true,
loadNavbar: true,
subMaxLevel: 3,
fallbackLanguages: ['en', 'es'],
nameLink: {
'/es/': '#/es/',
'/': '/'
},
alias: {
// es
'/es/problems/(\\d*)/': '/problems/$1/README.es.md',
'/es/(problems\/\\d*\/)?(?!.*\.js)(.*)': '/i18n/es/$2',
// fallback
'/(.*)/_navbar.md': '/_navbar.md',
'/problems/\\d*/_sidebar.md': '/_sidebar.md',
// external links
'/dat': 'https://raw.githubusercontent.com/datproject/dat/master/README.md',
'/hypercore': 'https://raw.githubusercontent.com/mafintosh/hypercore/master/README.md',
'/random-access-storage': 'https://raw.githubusercontent.com/random-access-storage/random-access-storage/master/README.md',
'/random-access-memory': 'https://raw.githubusercontent.com/random-access-storage/random-access-memory/master/README.md',
'/random-access-file': 'https://raw.githubusercontent.com/random-access-storage/random-access-file/master/README.md',
'/codecs': 'https://raw.githubusercontent.com/mafintosh/codecs/master/README.md',
'/pump': 'https://raw.githubusercontent.com/mafintosh/pump/master/README.md',
'/flush-write-stream': 'https://raw.githubusercontent.com/mafintosh/flush-write-stream/master/README.md',
'/hyperdb': 'https://raw.githubusercontent.com/mafintosh/hyperdb/master/README.md',
'/hyperid': 'https://raw.githubusercontent.com/mcollina/hyperid/master/README.md',
'/geut-discovery-swarm-webrtc': 'https://raw.githubusercontent.com/geut/discovery-swarm-webrtc/master/README.md',
'/choo': 'https://raw.githubusercontent.com/choojs/choo/master/README.md'
},
plugins: [
function(hook, vm) {
hook.beforeEach(function(content){
const isEs = /Solución/gi.test(content)
const firstLine = content.split('\n')[0]
if (!isEs) return content
let problemNumber = /\# (\d*) \-{1}/.exec(firstLine)
if (problemNumber && problemNumber[1]) {
problemNumber = problemNumber[1]
}
const testMatches = content.match(/\[test\.js\]\(\.\/test.js \'\:include\'\)/g)
if (testMatches){
testMatches.forEach(embed => {
content = content.replace(embed, `[test.js](../../../problems/0${problemNumber}/test.js ':include')`)
})
}
const solutionMatches = content.match(/\[solution\.js\]\(\.\/solution.js \'\:include\'\)/g)
if (solutionMatches){
solutionMatches.forEach(embed => {
content = content.replace(embed, `[solution.js](../../../problems/0${problemNumber}/solution.js ':include')`)
})
}
return content;
})
hook.afterEach(function(html, next) {
const { pathname } = window.location;
// redirect images
const matches = html.match(/src="\/[a-z0-9\-\/]*\/assets\/[a-z\.]*"/g)
if (matches) {
matches.forEach(src => {
html = html.replace(src, `src="${pathname}${src.match(/\/[a-z0-9\-\/]*(assets\/[a-z\.]*)/)[1]}"`)
})
}
next(html)
});
}
],
tabs: {
persist : true,
sync : false,
theme : 'classic',
tabComments: true,
tabHeadings: true
}
}
</script>
<script src="//unpkg.com/[email protected]/lib/docsify.min.js"></script>
<script src="//unpkg.com/[email protected]/lib/plugins/search.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/emoji.min.js"></script>
<script src="//unpkg.com/docsify-copy-code"></script>
<script src="//unpkg.com/docsify-pagination/dist/docsify-pagination.min.js"></script>
<!-- docsify-tabs (latest v1.x.x) -->
<script src="https://cdn.jsdelivr.net/npm/docsify-tabs@1"></script>
<script>
if (typeof navigator.serviceWorker !== 'undefined') {
navigator.serviceWorker.register('sw.js')
}
</script>
</body>
</html>