diff --git a/frontend/src/pages/posts/[slug].astro b/frontend/src/pages/posts/[slug].astro
index 3e99f2f..da4c595 100644
--- a/frontend/src/pages/posts/[slug].astro
+++ b/frontend/src/pages/posts/[slug].astro
@@ -14,12 +14,30 @@ let post: PostDetail | null = null;
let html = '';
let error = '';
+// Custom citation pre-processor
+function processCitations(text: string) {
+ // Using RegExp constructor to completely bypass Astro/esbuild literal parsing bugs
+ const citeRegex = new RegExp('\\', 'g');
+
+ return text.replace(citeRegex, (match, citations) => {
+ const links = citations.split(',').map((c: string) => {
+ const id = c.trim();
+ return `${id}`;
+ }).join(', ');
+
+ return `[${links}]`;
+ });
+}
+
try {
const response = await fetch(`${API_URL}/api/posts/${slug}`);
if (response.ok) {
post = await response.json();
if (post) {
- html = await marked.parse(post.content);
+ // 1. Process citations first
+ const processedContent = processCitations(post.content);
+ // 2. Then parse the rest of the markdown
+ html = await marked.parse(processedContent);
}
} else {
error = 'Post not found';
@@ -76,12 +94,10 @@ function formatSlug(slug: string) {
)}
-
-