Skip to content

Commit 115aa85

Browse files
committed
Migration
1 parent c8a6c5c commit 115aa85

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

scripts/generate-md.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ const targetDirName = process.argv[2] || '../public';
1111
const OUTPUT_DIR = path.resolve(__dirname, targetDirName);
1212

1313
// Helper to convert kebab-case file name to PascalCase component name
14-
const toPascalCase = (str) => str.replace(/(^\w|-\w)/g, clear => clear.replace('-', '').toUpperCase());
14+
const toPascalCase = (str) => {
15+
if (/^\d/.test(str)) return `Error${str}`;
16+
return str.replace(/(^\w|-\w)/g, clear => clear.replace('-', '').toUpperCase());
17+
};
1518

1619
async function getReusableComponents() {
1720
const components = {};

src/pages/[...slug].astro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ const breadcrumbs = fullBreadcrumbs.length > 0 ? fullBreadcrumbs.slice(0, -1) :
193193
194194
// 3. Global Reusable Components
195195
const reusableComponents = import.meta.glob('../components/reusable/*.md', { eager: true });
196-
const toPascalCase = (str) => str.replace(/(^\w|-\w)/g, clear => clear.replace('-', '').toUpperCase());
196+
const toPascalCase = (str) => {
197+
if (/^\d/.test(str)) return `Error${str}`;
198+
return str.replace(/(^\w|-\w)/g, clear => clear.replace('-', '').toUpperCase());
199+
};
197200
198201
const globalComponents = Object.entries(reusableComponents).reduce((acc, [path, module]) => {
199202
const fileName = path.split('/').pop().replace('.md', '');

src/plugins/remark-strip-imports.mjs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export function remarkStripImports() {
1212
const filteredLines = lines.filter(line => {
1313
const isBad = (
1414
line.includes("@theme/") ||
15-
line.includes("@site/src/components/reusable/") ||
1615
line.includes("@site/src/components/Details") ||
1716
line.includes("@site/src/components/InlineTooltip") ||
1817
line.includes("@site/src/components/ZoomImage") ||

0 commit comments

Comments
 (0)