Files
bitvid/views/community-guidelines.html

54 lines
1.8 KiB
HTML

<!-- views/community-guidelines.html -->
<section class="mb-8">
<!--
This card has a white background and shadow, similar to your other partials.
We also add text-gray-900 to override the global body text color.
-->
<div class="bg-white p-6 rounded-lg shadow-md text-gray-900">
<h2 class="text-2xl font-bold mb-4 text-gray-700">Community Guidelines</h2>
<!--
The .markdown-body class can use your markdown.css
so headings, paragraphs, etc. are styled nicely.
-->
<div id="markdown-container" class="markdown-body">
<p class="text-gray-500">Loading content...</p>
</div>
</div>
</section>
<script>
(async () => {
try {
// Fetch the markdown file (change path if needed)
const response = await fetch("content/community-guidelines.md");
if (!response.ok) {
throw new Error("Failed to load community-guidelines.md");
}
const markdownText = await response.text();
// Convert to HTML with Marked (make sure Marked is loaded globally in index.html)
const html = marked.parse(markdownText);
// Insert into the container
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = html;
}
// Optionally highlight code blocks if highlight.js is available globally
document.querySelectorAll("pre code").forEach((block) => {
hljs.highlightBlock(block);
});
} catch (err) {
console.error("Error loading community guidelines:", err);
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = `
<p class="text-red-500">Error loading content. Please try again later.</p>
`;
}
}
})();
</script>