Files
aragrp/lib/blockquote-variant.ts
ar.badieiandCursor 6cb9e2aac5 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>
2026-07-12 01:55:50 +03:30

23 lines
625 B
TypeScript

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";
}