-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
85 lines (73 loc) · 3.84 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
<!DOCTYPE html>
<html lang="en" data-theme="forest">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" sizes="180x180" href="/con-ai/public/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/con-ai/public/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/con-ai/public/favicon-16x16.png">
<link rel="manifest" href="/con-ai/public/site.webmanifest">
<link rel="mask-icon" href="/con-ai/public/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,200..1000;1,200..1000&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:[email protected]&display=swap" rel="stylesheet">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>AI Safety Experiments: A dive into Constitutional AI</title>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked-smartypants/lib/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked-highlight/lib/index.umd.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/styles/default.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/highlight.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/marked-custom-heading-id/lib/index.umd.js"></script>
<link href="./output.css" rel="stylesheet">
</head>
<body>
<!-- Main Container -->
<div class="min-h-screen flex flex-col items-center">
<header class="prose w-full py-6 text-center">
<h1 class="text-primary mb-1">AI Safety Experiments</h1>
<p class="mt-0">A dive into Constitutional AI</p>
</header>
<!-- Blog Content Section -->
<main class="w-full px-6 md:px-0 md:w-2/5 mt-10 flex-1">
<article class="prose mb-10 w-full max-w-none prose-em:text-primary prose-blockquote:text-secondary prose-a:text-accent prose-strong:text-primary prose-code:not-prose prose-ol:text-base-content prose-ol:text-extrabold" id="markdown-content">
<!-- Markdown content will be injected here -->
</article>
</main>
</div>
<script type="module" >
import hljs from 'https://unpkg.com/@highlightjs/[email protected]/es/highlight.min.js';
// Fetch and parse the Markdown file
async function loadMarkdown() {
try {
// Fetch the markdown file (assumed to be in the same directory as 'post.md')
const response = await fetch('post.md');
const markdown = await response.text();
const {markedHighlight} = globalThis.markedHighlight;
const markedCustomHeadingId = globalThis.markedCustomHeadingId;
marked.use(markedSmartypants.markedSmartypants());
marked.use(
markedHighlight({
langPrefix: 'hljs language-',
highlight(code, lang, info) {
const language = hljs.getLanguage(lang) ? lang : 'plaintext';
return hljs.highlight(code, { language }).value;
}
})
);
marked.use(markedCustomHeadingId());
// Convert Markdown to HTML
// Insert the HTML into the DOM
document.getElementById('markdown-content').innerHTML = marked.parse(markdown);
} catch (error) {
console.error('Error fetching the markdown file:', error);
document.getElementById('markdown-content').innerHTML = '<p>There was an error loading the markdown content. Please try again later.</p>';
}
}
// Load the Markdown on page load
window.onload = loadMarkdown;
</script>
</body>
</html>