fix(blog): add missing mintelP/TLDR renderers, fix iconList, diagram blocks, reduce AI components to 13
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🏗️ Build (push) Successful in 11m52s
Build & Deploy / 🚀 Deploy (push) Successful in 14s
Build & Deploy / 🧪 QA (push) Successful in 1m15s
Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 6m31s
Build & Deploy / 🔔 Notify (push) Successful in 2s
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🏗️ Build (push) Successful in 11m52s
Build & Deploy / 🚀 Deploy (push) Successful in 14s
Build & Deploy / 🧪 QA (push) Successful in 1m15s
Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 6m31s
Build & Deploy / 🔔 Notify (push) Successful in 2s
- Add mintelP renderer with inline markdown link/marker support (228 broken blocks) - Add mintelTldr renderer for summary boxes - Fix iconList to display item.title instead of empty item.description - Rewire all 6 diagram block types to render via Mermaid - Remove ai property from 30 non-essential blocks (46 -> 13) - Tighten MemeCard to 5 verified templates, max 1 per article - Fix PerformanceChartBlock syntax after ai removal
This commit is contained in:
@@ -5,6 +5,39 @@ import { Mermaid } from "@/src/components/Mermaid";
|
||||
import { LeadMagnet } from "@/src/components/LeadMagnet";
|
||||
import { ComparisonRow } from "@/src/components/Landing/ComparisonRow";
|
||||
import { mdxComponents } from "../content-engine/components";
|
||||
import React from "react";
|
||||
|
||||
/**
|
||||
* Renders markdown-style inline links [text](/url) as <a> tags.
|
||||
* Used by mintelP blocks which store body text with links.
|
||||
*/
|
||||
function renderInlineMarkdown(text: string): React.ReactNode {
|
||||
if (!text) return null;
|
||||
const parts = text.split(/(\[[^\]]+\]\([^)]+\)|<Marker>[^<]*<\/Marker>)/);
|
||||
return parts.map((part, i) => {
|
||||
const linkMatch = part.match(/\[([^\]]+)\]\(([^)]+)\)/);
|
||||
if (linkMatch) {
|
||||
return (
|
||||
<a
|
||||
key={i}
|
||||
href={linkMatch[2]}
|
||||
className="text-slate-900 underline underline-offset-4 hover:text-slate-600 transition-colors"
|
||||
>
|
||||
{linkMatch[1]}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
const markerMatch = part.match(/<Marker>([^<]*)<\/Marker>/);
|
||||
if (markerMatch) {
|
||||
return (
|
||||
<mark key={i} className="bg-yellow-100/60 px-1 rounded">
|
||||
{markerMatch[1]}
|
||||
</mark>
|
||||
);
|
||||
}
|
||||
return <React.Fragment key={i}>{part}</React.Fragment>;
|
||||
});
|
||||
}
|
||||
|
||||
const jsxConverters: JSXConverters = {
|
||||
blocks: {
|
||||
@@ -49,6 +82,15 @@ const jsxConverters: JSXConverters = {
|
||||
showShare={true}
|
||||
/>
|
||||
),
|
||||
// --- Core text blocks ---
|
||||
mintelP: ({ node }: any) => (
|
||||
<p className="text-base md:text-lg text-slate-600 leading-relaxed mb-6">
|
||||
{renderInlineMarkdown(node.fields.text)}
|
||||
</p>
|
||||
),
|
||||
mintelTldr: ({ node }: any) => (
|
||||
<mdxComponents.TLDR>{node.fields.content}</mdxComponents.TLDR>
|
||||
),
|
||||
// --- MDX Registry Injections ---
|
||||
leadParagraph: ({ node }: any) => (
|
||||
<mdxComponents.LeadParagraph>
|
||||
@@ -81,37 +123,46 @@ const jsxConverters: JSXConverters = {
|
||||
/>
|
||||
),
|
||||
diagramState: ({ node }: any) => (
|
||||
<mdxComponents.DiagramState
|
||||
states={[]}
|
||||
transitions={[]}
|
||||
caption={node.fields.definition}
|
||||
/>
|
||||
<div className="my-8">
|
||||
<Mermaid id={`diagram-state-${node.fields.id || Date.now()}`}>
|
||||
{node.fields.definition}
|
||||
</Mermaid>
|
||||
</div>
|
||||
),
|
||||
diagramTimeline: ({ node }: any) => (
|
||||
<mdxComponents.DiagramTimeline
|
||||
events={[]}
|
||||
title={node.fields.definition}
|
||||
/>
|
||||
<div className="my-8">
|
||||
<Mermaid id={`diagram-timeline-${node.fields.id || Date.now()}`}>
|
||||
{node.fields.definition}
|
||||
</Mermaid>
|
||||
</div>
|
||||
),
|
||||
diagramGantt: ({ node }: any) => (
|
||||
<mdxComponents.DiagramGantt tasks={[]} title={node.fields.definition} />
|
||||
<div className="my-8">
|
||||
<Mermaid id={`diagram-gantt-${node.fields.id || Date.now()}`}>
|
||||
{node.fields.definition}
|
||||
</Mermaid>
|
||||
</div>
|
||||
),
|
||||
diagramPie: ({ node }: any) => (
|
||||
<mdxComponents.DiagramPie data={[]} title={node.fields.definition} />
|
||||
<div className="my-8">
|
||||
<Mermaid id={`diagram-pie-${node.fields.id || Date.now()}`}>
|
||||
{node.fields.definition}
|
||||
</Mermaid>
|
||||
</div>
|
||||
),
|
||||
diagramSequence: ({ node }: any) => (
|
||||
<mdxComponents.DiagramSequence
|
||||
participants={[]}
|
||||
steps={[]}
|
||||
title={node.fields.definition}
|
||||
/>
|
||||
<div className="my-8">
|
||||
<Mermaid id={`diagram-seq-${node.fields.id || Date.now()}`}>
|
||||
{node.fields.definition}
|
||||
</Mermaid>
|
||||
</div>
|
||||
),
|
||||
diagramFlow: ({ node }: any) => (
|
||||
<mdxComponents.DiagramFlow
|
||||
nodes={[]}
|
||||
edges={[]}
|
||||
title={node.fields.definition}
|
||||
/>
|
||||
<div className="my-8">
|
||||
<Mermaid id={`diagram-flow-${node.fields.id || Date.now()}`}>
|
||||
{node.fields.definition}
|
||||
</Mermaid>
|
||||
</div>
|
||||
),
|
||||
|
||||
waterfallChart: ({ node }: any) => (
|
||||
@@ -131,7 +182,7 @@ const jsxConverters: JSXConverters = {
|
||||
{node.fields.items?.map((item: any, i: number) => (
|
||||
// @ts-ignore
|
||||
<mdxComponents.IconListItem key={i} icon={item.icon || "check"}>
|
||||
{item.description}
|
||||
{item.title || item.description}
|
||||
</mdxComponents.IconListItem>
|
||||
))}
|
||||
</mdxComponents.IconList>
|
||||
|
||||
Reference in New Issue
Block a user