Files
bitvid/views/about.html
T

75 lines
2.4 KiB
HTML

<!-- views/about.html -->
<section class="bv-stack" data-ds="new" aria-labelledby="aboutHeading">
<article class="card p-lg">
<div class="bv-stack bv-stack--tight">
<h2 id="aboutHeading" class="text-2xl font-semibold text-text-strong">
About bitvid
</h2>
<div id="markdown-container" class="markdown-prose">
<p class="text-muted-strong">Loading content...</p>
</div>
</div>
</article>
</section>
<script>
(() => {
// Provide no-op fallback loggers so embeds stay functional if bitvidLogger is unavailable.
const noopLogger = {
log: () => {},
info: () => {},
warn: () => {},
error: () => {},
};
const dev = window.bitvidLogger?.dev || noopLogger;
const user = window.bitvidLogger?.user || noopLogger;
const loadMarkdown = async () => {
try {
const response = await fetch("content/about.md");
if (!response.ok) {
throw new Error("Failed to load about.md");
}
const markdownText = await response.text();
// Convert the markdown to HTML (requires "marked" loaded globally)
const html = marked.parse(markdownText);
// Insert the HTML into the container
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = html;
const highlighter = window.hljs;
const highlight =
highlighter && typeof highlighter.highlightElement === "function"
? (block) => highlighter.highlightElement(block)
: highlighter && typeof highlighter.highlightBlock === "function"
? (block) => highlighter.highlightBlock(block)
: null;
if (highlight) {
container.querySelectorAll("pre code").forEach((block) => {
try {
highlight(block);
} catch (highlightError) {
dev.warn("Failed to highlight code block.", highlightError);
}
});
}
}
} catch (err) {
user.error("Error loading About content:", err);
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = `
<p class="text-critical-strong">Error loading content. Please try again later.</p>
`;
}
}
};
loadMarkdown();
})();
</script>