Core: Fix remark-dynamic-content

This commit is contained in:
Fuma Nama
2024-03-23 13:19:08 +08:00
parent 38d6f22c46
commit 0c01300d16
2 changed files with 9 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"fumadocs-core": patch
---
Fix remark-dynamic-content ignored code blocks
@@ -36,10 +36,12 @@ export function remarkDynamicContent(
return (tree) => {
visit(tree, filter, (node) => {
if (!('value' in node) || typeof node.value === 'string') return;
const canReplace = 'value' in node && typeof node.value === 'string';
if (!canReplace) return;
const result = regex.exec(node.value);
if (result?.groups?.path) {
if (result) {
const dest = path.resolve(cwd, result[1]);
let value = fs.readFileSync(dest).toString();
if (trim) value = value.trim();