-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharticle.html
More file actions
36 lines (33 loc) · 994 Bytes
/
article.html
File metadata and controls
36 lines (33 loc) · 994 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Post</title>
<link rel="stylesheet" href="assets/style.css">
</head>
<body>
<div class="container">
<a href="index.html">← Back</a>
<div id="content">Loading...</div>
</div>
<!-- Include Marked.js via CDN -->
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<!-- Your custom script to fetch and render Markdown -->
<script>
const urlParams = new URLSearchParams(window.location.search);
const post = urlParams.get('post');
if (post) {
fetch('posts/' + post)
.then(res => res.text())
.then(text => {
document.getElementById('content').innerHTML = marked.parse(text);
})
.catch(() => {
document.getElementById('content').innerHTML = "<p>Post not found.</p>";
});
} else {
document.getElementById('content').innerHTML = "<p>No post specified.</p>";
}
</script>
</body>
</html>