chore: remove legacy mdx artifacts and dependencies
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🧪 QA (push) Failing after 55s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / ⚡ Performance & Accessibility (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🧪 QA (push) Failing after 55s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / ⚡ Performance & Accessibility (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
This commit is contained in:
@@ -7,7 +7,7 @@ function propValue(chunk: string, prop: string): string {
|
||||
// Match prop="value" or prop='value' or prop={value}
|
||||
// and also multiline props like prop={\n [\n {...}\n ]\n}
|
||||
// For arrays or complex objects passed as props, basic regex might fail,
|
||||
// but the MDX in klz-cables usually uses simpler props or children.
|
||||
// but the Markdown in klz-cables usually uses simpler props or children.
|
||||
const match =
|
||||
chunk.match(new RegExp(`${prop}=["']([^"']+)["']`)) ||
|
||||
chunk.match(new RegExp(`${prop}=\\{([^}]+)\\}`));
|
||||
@@ -20,7 +20,7 @@ function extractItemsProp(chunk: string, startTag: string): any[] {
|
||||
if (itemsMatch) {
|
||||
try {
|
||||
const arrayString = itemsMatch[1].trim();
|
||||
// Since klz-cables MDX passes pure JS object arrays like `items={[{title: 'A', content: 'B'}]}`,
|
||||
// Since klz-cables Markdown passes pure JS object arrays like `items={[{title: 'A', content: 'B'}]}`,
|
||||
// parsing it via Regex to JSON is extremely brittle due to unquoted keys and trailing commas.
|
||||
// Using `new Function` safely evaluates the array AST directly in this Node script environment.
|
||||
const fn = new Function(`return ${arrayString};`);
|
||||
@@ -225,7 +225,7 @@ export function parseMarkdownToLexical(markdown: string): any[] {
|
||||
},
|
||||
];
|
||||
|
||||
function cleanMdxContent(text: string): string {
|
||||
function cleanMarkdownContent(text: string): string {
|
||||
return text
|
||||
.replace(/<section[^>]*>/g, '')
|
||||
.replace(/<\/section>/g, '')
|
||||
@@ -238,7 +238,7 @@ export function parseMarkdownToLexical(markdown: string): any[] {
|
||||
.trim();
|
||||
}
|
||||
|
||||
content = cleanMdxContent(content);
|
||||
content = cleanMarkdownContent(content);
|
||||
|
||||
const placeholders = new Map<string, any>();
|
||||
let placeholderIdx = 0;
|
||||
|
||||
Reference in New Issue
Block a user