diff --git a/server/rehype-hljs-var.ts b/server/rehype-hljs-var.ts index 2fa08ad0aa..ad31f9b236 100644 --- a/server/rehype-hljs-var.ts +++ b/server/rehype-hljs-var.ts @@ -138,7 +138,7 @@ export const rehypeVarInHLJS = ( // can tell whether a given index falls within a placeholder. const placeholderIndices = new Map(); placeholders.forEach((p) => { - placeholderIndices.set(p.index, p); + placeholderIndices.set(p.index, p[0]); }); let valueIdx = 0; @@ -146,7 +146,8 @@ export const rehypeVarInHLJS = ( // The current index is in a placeholder, so add the original Var // component to newChildren. if (placeholderIndices.has(valueIdx)) { - const placeholder = valueIdx + placeholderIndices.get(valueIdx); + const placeholder = placeholderIndices.get(valueIdx); + console.log("placeholder:", placeholder); valueIdx += placeholder.length; newChildren.push(placeholdersToVars[placeholder]); continue;