Skip to content

Commit f04aad9

Browse files
Add markdown-it website support
1 parent 006f0e5 commit f04aad9

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

index.html

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
7+
<meta name="description" content="Write Markdown as Task descriptions for your students" />
8+
<meta name="show-in" content="*" />
9+
10+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/default.min.css" integrity="sha512-hasIneQUHlh06VNBe7f6ZcHmeRTLIaQWFd43YriJ0UND19bvYRauxthDg8E4eVNPm9bRUhr5JGeqH7FRFXQu5g==" crossorigin="anonymous" referrerpolicy="no-referrer" />
11+
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>
12+
<script src="https://cdnjs.cloudflare.com/ajax/libs/markdown-it/13.0.1/markdown-it.min.js"></script>
13+
14+
<script src="https://edrys-org.github.io/edrys/module/edrys.js"></script>
15+
<script defer src="https://edrys-org.github.io/edrys/module/vendor/alpine.min.js"></script>
16+
<link rel="stylesheet" href="https://edrys-org.github.io/edrys/module/vendor/water.min.css" />
17+
<link rel="stylesheet" href="https://edrys-org.github.io/edrys/module/vendor/open-iconic/css/open-iconic.min.css" />
18+
19+
<script>
20+
function init() {
21+
if (window.md) return
22+
23+
window.md = markdownit()
24+
25+
// enable everything
26+
window.md.options.html = true
27+
window.md.options.linkify = true
28+
window.md.options.typographer = true
29+
30+
window.md.options.highlight = function (str, lang) {
31+
if (lang && hljs.getLanguage(lang)) {
32+
try {
33+
return '<pre class="hljs"><code style="border-radius: 0px">' +
34+
hljs.highlight(str, { language: lang, ignoreIllegals: true }).value +
35+
'</code></pre>';
36+
} catch (__) {}
37+
}
38+
39+
return '<pre class="hljs"><code style="border-radius: 0px">' + md.utils.escapeHtml(str) + '</code></pre>';
40+
}
41+
}
42+
43+
function render(content) {
44+
if (window.md) {
45+
document.body.innerHTML = md.render(content)
46+
}
47+
}
48+
49+
window.onload = init
50+
51+
Edrys.onReady(() => {
52+
console.log("Markdown-IT loaded")
53+
54+
init()
55+
56+
if (Edrys.module.config) {
57+
switch(Edrys.role) {
58+
case "teacher": {
59+
render(Edrys.config.teacher || Edrys.config.md)
60+
break
61+
}
62+
case "student": {
63+
render(Edrys.config.student || Edrys.config.md)
64+
break
65+
}
66+
case "station": {
67+
render(Edrys.config.station || Edrys.config.md)
68+
break
69+
}
70+
}
71+
}
72+
});
73+
</script>
74+
75+
<title>Edrys - Markdown-IT module</title>
76+
</head>
77+
<body>
78+
<h1>Edrys Markdown-IT Module</h1>
79+
80+
<p>
81+
Please refer to the <a href="https://github.com/Cross-Lab-Project/edrys_module-markdown-it">README</a> of this project.
82+
</p>
83+
</body>
84+
</html>

0 commit comments

Comments
 (0)