feat(markdown): add markdownDefaults module with constants and extractTitle

This commit is contained in:
Hiren Kangad
2026-03-13 11:21:27 +05:30
parent 50c34a409f
commit f989a8111b
+18
View File
@@ -0,0 +1,18 @@
// markdownDefaults.ts — default values and constraints for markdown blocks
export const MD_DEFAULT_WIDTH = 450;
export const MD_MIN_WIDTH = 250;
export const MD_MAX_WIDTH = 800;
export const MD_DEFAULT_BG = '#232336';
export const MD_DEFAULT_TEXT_COLOR = '#e0e0e0';
export const MD_DEFAULT_ACCENT = '#7950f2';
export const MD_DEFAULT_PADDING = 16;
export const MD_DEFAULT_CORNER_RADIUS = 10;
export const MD_HEADER_BG = '#2a2a42';
export const MD_MAX_CONTENT_LENGTH = 50_000;
/** Extract the first H1 from markdown content for the card header title. */
export function extractTitle(content: string): string {
const match = content.match(/^#\s+(.+)$/m);
return match ? match[1].trim() : 'Untitled';
}