-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathviewer.html
More file actions
48 lines (46 loc) · 1.62 KB
/
Copy pathviewer.html
File metadata and controls
48 lines (46 loc) · 1.62 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Learning Module - A* Pathfinding</title>
<link rel="stylesheet" href="shared.css">
<style>
.content-area { padding: 2rem; }
</style>
</head>
<body>
<nav class="nav-bar">
<span>Mastering A*</span>
<div>
<a href="index.html">Home</a>
<a href="demo.html">Visualizer</a>
</div>
</nav>
<div class="container content-area" id="content">Loading content...</div>
<script>
const urlParams = new URLSearchParams(window.location.search);
const fileName = urlParams.get('file');
if (fileName) {
fetch(fileName)
.then(response => {
if (!response.ok) throw new Error('File not found');
return response.text();
})
.then(text => {
// Basic markdown to HTML
document.getElementById('content').innerHTML = text
.replace(/^# (.*$)/gim, '<h1>$1</h1>')
.replace(/^## (.*$)/gim, '<h2>$1</h2>')
.replace(/\*\*(.*)\*\*/gim, '<b>$1</b>')
.replace(/\n/gim, '<br>');
})
.catch(err => {
document.getElementById('content').innerHTML = 'Error loading content: ' + err.message;
});
} else {
document.getElementById('content').innerHTML = 'No module specified.';
}
</script>
</body>
</html>