mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
75 lines
2.4 KiB
HTML
75 lines
2.4 KiB
HTML
<!-- views/links.html -->
|
|
<section class="bv-stack" data-ds="new" aria-labelledby="linksHeading">
|
|
<article class="card p-lg">
|
|
<div class="bv-stack bv-stack--tight">
|
|
<h2 id="linksHeading" class="text-2xl font-semibold text-text-strong">
|
|
bitvid Links
|
|
</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/links.md");
|
|
if (!response.ok) {
|
|
throw new Error("Failed to load links.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 Links 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>
|