Skip to content

Commit fa036b0

Browse files
authored
docs: replace cn in examples (#1270)
1 parent 2116678 commit fa036b0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/mdsx.config.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,18 @@ export function rehypeComponentExample() {
199199
};
200200
}
201201

202+
function transformComponentSourceContent(src = "") {
203+
return src.replaceAll(`import { cn } from "$lib/utils/styles.js"`, `import cn from "clsx"`);
204+
}
205+
202206
function getComponentSourceFileContent(src = "") {
203207
if (!src) return null;
204208

205209
// Read the source file.
206210
const filePath = path.join(process.cwd(), `./src/lib/components/demos/${src}.svelte`);
207211

208-
return prettier.format(readFileSync(filePath, "utf-8"), codeBlockPrettierConfig);
212+
return prettier.format(
213+
transformComponentSourceContent(readFileSync(filePath, "utf-8")),
214+
codeBlockPrettierConfig
215+
);
209216
}

0 commit comments

Comments
 (0)