mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 16:02:26 +00:00
58 lines
1.8 KiB
HTML
58 lines
1.8 KiB
HTML
<!-- views/ipns.html -->
|
|
<section class="bv-stack" data-ds="new" aria-labelledby="ipnsHeading">
|
|
<article class="card p-lg">
|
|
<div class="bv-stack bv-stack--tight">
|
|
<h2 id="ipnsHeading" class="text-2xl font-semibold text-text-strong">
|
|
IPNS Gateways
|
|
</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;
|
|
|
|
(async () => {
|
|
try {
|
|
const response = await fetch("content/ipns.md");
|
|
if (!response.ok) {
|
|
throw new Error("Failed to load IPNS markdown file.");
|
|
}
|
|
const markdownText = await response.text();
|
|
|
|
// Convert to HTML with Marked (make sure "marked" is loaded globally)
|
|
const html = marked.parse(markdownText);
|
|
|
|
// Insert final HTML into #markdown-container
|
|
const container = document.getElementById("markdown-container");
|
|
if (container) {
|
|
container.innerHTML = html;
|
|
}
|
|
|
|
// Optional: highlight code blocks (requires "hljs" loaded globally)
|
|
document.querySelectorAll("pre code").forEach((block) => {
|
|
hljs.highlightBlock(block);
|
|
});
|
|
} catch (err) {
|
|
user.error("Error loading IPNS 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>
|
|
`;
|
|
}
|
|
}
|
|
})();
|
|
</script>
|