fix(blog): restore live blockquote styling and quote-mark SVG
- restores the migrated blog blockquotes to the live site’s visual treatment - adds the self-hosted quote-mark SVG and matches its live positioning - updates the extractor, audit scripts, and migration reports to reflect the blockquote work
This commit is contained in:
@@ -9,11 +9,13 @@ const failures = [];
|
||||
const files = await fg('src/content/blog/**/*.{md,mdx}', { cwd: root, absolute: true });
|
||||
let faqPosts = 0;
|
||||
let faqQuestions = 0;
|
||||
let blockquotes = 0;
|
||||
|
||||
for (const file of files) {
|
||||
const source = await fs.readFile(file, 'utf8');
|
||||
const { content, data } = matter(source);
|
||||
const body = content.trimStart();
|
||||
blockquotes += [...content.matchAll(/^>\s+/gm)].length;
|
||||
if (body.startsWith('# ')) failures.push(`${path.relative(root, file)}: body begins with a duplicate article title`);
|
||||
if (body.includes(data.featuredImage) && body.indexOf(data.featuredImage) < 500) {
|
||||
failures.push(`${path.relative(root, file)}: body begins with a duplicate featured image`);
|
||||
@@ -55,6 +57,7 @@ const report = [
|
||||
'',
|
||||
`Checked ${files.length} blog post bodies for layout content duplicated in Markdown.`,
|
||||
`Verified ${faqQuestions} FAQ questions across ${faqPosts} FAQ-bearing posts.`,
|
||||
`Detected ${blockquotes} source-faithful blog blockquotes.`,
|
||||
'',
|
||||
failures.length ? failures.map((failure) => `- ${failure}`).join('\n') : 'No duplicated article headers or invalid MDX FAQ components were detected.',
|
||||
''
|
||||
|
||||
@@ -23,6 +23,7 @@ for (const match of visualSource.matchAll(/['"](?<reference>\/assets\/images\/[^
|
||||
}
|
||||
await checkAsset('/assets/images/hero-library-index.webp', 'library banner');
|
||||
await checkAsset('/assets/images/rbt-toddler-play.webp', 'consultation form background');
|
||||
await checkAsset('/assets/images/blockquote.svg', 'blog blockquote decoration');
|
||||
|
||||
for (const file of await fg('src/content/blog/**/*.{md,mdx}', { cwd: root, absolute: true })) {
|
||||
const { data } = matter(await fs.readFile(file, 'utf8'));
|
||||
|
||||
@@ -83,6 +83,7 @@ function markdownFrom(html) {
|
||||
'';
|
||||
body = body
|
||||
.replace(/<(script|style|noscript|header|footer|nav|form)\b[\s\S]*?<\/\1>/gi, '')
|
||||
.replace(/<blockquote[^>]*>([\s\S]*?)<\/blockquote>/gi, (_, value) => `\n\n> ${inline(value)}\n\n`)
|
||||
.replace(/<img[^>]+src=["']([^"']+)["'][^>]*alt=["']([^"']*)["'][^>]*>/gi, (_, src, alt) => {
|
||||
const local = asset(src);
|
||||
return local ? `\n\n\n\n` : '';
|
||||
|
||||
Reference in New Issue
Block a user