Scope markdown view scripts to reload content

This commit is contained in:
thePR0M3TH3AN committed 2025-10-17 11:06:18 -04:00
1 parent f087076401
commit 50f7fe9657
6 files changed
+303 -279

No files matched your search

+50 -46
View File
@@ -13,58 +13,62 @@
</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;
(() => {
// 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/about.md");
if (!response.ok) {
throw new Error("Failed to load about.md");
}
const markdownText = await response.text();
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);
// 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;
// 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;
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);
}
});
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>
`;
}
}
} 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>
+51 -47
View File
@@ -16,59 +16,63 @@
</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;
(() => {
// 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 {
// 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();
const loadMarkdown = 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);
// 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;
// Insert 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;
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);
}
});
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 community guidelines:", err);
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = `
<p class="text-critical-strong">Error loading content. Please try again later.</p>
`;
}
}
} catch (err) {
user.error("Error loading community guidelines:", 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>
+51 -47
View File
@@ -16,60 +16,64 @@
</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;
(() => {
// 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 {
// Fetch the Markdown file
const response = await fetch("content/getting-started.md");
if (!response.ok) {
throw new Error("Failed to load getting-started.md");
}
const loadMarkdown = async () => {
try {
// Fetch the Markdown file
const response = await fetch("content/getting-started.md");
if (!response.ok) {
throw new Error("Failed to load getting-started.md");
}
const markdownText = await response.text();
const markdownText = await response.text();
// Convert to HTML with Marked (assuming marked is globally available)
const html = marked.parse(markdownText);
// Convert to HTML with Marked (assuming marked is globally available)
const html = marked.parse(markdownText);
// Insert into #markdown-container
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = html;
// Insert into #markdown-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;
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);
}
});
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 'Getting Started' 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>
`;
}
}
} catch (err) {
user.error("Error loading 'Getting Started' 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>
+50 -46
View File
@@ -13,58 +13,62 @@
</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;
(() => {
// 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();
const loadMarkdown = 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);
// 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;
// Insert final HTML into #markdown-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;
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);
}
});
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 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>
`;
}
}
} 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>
`;
}
}
};
loadMarkdown();
})();
</script>
+50 -46
View File
@@ -13,58 +13,62 @@
</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;
(() => {
// 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/links.md");
if (!response.ok) {
throw new Error("Failed to load links.md");
}
const markdownText = await response.text();
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);
// 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;
// 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;
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);
}
});
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>
`;
}
}
} 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>
+51 -47
View File
@@ -13,59 +13,63 @@
</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;
(() => {
// 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 {
// Fetch your roadmap markdown
const response = await fetch("content/roadmap.md");
if (!response.ok) {
throw new Error("Failed to load roadmap.md");
}
const markdownText = await response.text();
const loadMarkdown = async () => {
try {
// Fetch your roadmap markdown
const response = await fetch("content/roadmap.md");
if (!response.ok) {
throw new Error("Failed to load roadmap.md");
}
const markdownText = await response.text();
// Convert markdown to HTML (marked must be globally available)
const html = marked.parse(markdownText);
// Convert markdown to HTML (marked must be globally available)
const html = marked.parse(markdownText);
// Insert into the container
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = html;
// Insert 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;
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);
}
});
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 roadmap:", err);
const container = document.getElementById("markdown-container");
if (container) {
container.innerHTML = `
<p class="text-critical-strong">Error loading content. Please try again later.</p>
`;
}
}
} catch (err) {
user.error("Error loading roadmap:", 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>