feat: auto-detect blockquote and table colors from content

Replace manual hashtags and color cycling with content-tone heuristics for blockquotes and tables, and refine blockquote layout with a centered icon, larger sizing, and clearer contrast over background decorations.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ar.badiei
2026-07-12 01:55:50 +03:30
co-authored by Cursor
parent a47ec493c5
commit 6cb9e2aac5
11 changed files with 370 additions and 64 deletions
+22
View File
@@ -0,0 +1,22 @@
import type { BlockquoteVariant } from "@/lib/blog-blocks";
import { detectContentTone, stripHtml } from "@/lib/content-tone";
/**
* تشخیص variant نقل‌قول از روی متن و منبع.
* اولویت: منبع → هشدار → نکته مثبت → خنثی.
*/
export function detectBlockquoteVariant(
contentHtml: string,
citation?: string
): BlockquoteVariant {
if (citation?.trim()) {
return "gray";
}
const text = stripHtml(contentHtml);
const tone = detectContentTone(text);
if (tone === "warning") return "yellow";
if (tone === "positive") return "green";
return "gray";
}