rajoute le support de l'utilisation de markdown (sur un sous-ensemble) dans la description des campagnes et des propositions

This commit is contained in:
Yannick Le Duc
2025-08-27 10:47:01 +02:00
parent 228be1b6f2
commit 5c5c5d11e3
14 changed files with 742 additions and 88 deletions

View File

@@ -0,0 +1,37 @@
'use client';
import React from 'react';
import { parseMarkdown } from '@/lib/markdown';
interface MarkdownContentProps {
content: string;
className?: string;
maxLength?: number;
showPreview?: boolean;
}
export function MarkdownContent({
content,
className = "",
maxLength,
showPreview = false
}: MarkdownContentProps) {
if (!content) {
return null;
}
// Si showPreview est activé et qu'une longueur max est définie, tronquer
const displayContent = showPreview && maxLength && content.length > maxLength
? content.substring(0, maxLength) + '...'
: content;
// Parser le markdown
const parsedContent = parseMarkdown(displayContent);
return (
<div
className={`prose prose-sm max-w-none ${className}`}
dangerouslySetInnerHTML={{ __html: parsedContent }}
/>
);
}