UNPKG

@spoolcms/nextjs

Version:

The beautiful headless CMS for Next.js developers

40 lines (39 loc) 1.29 kB
interface SpoolContentProps { content: string; className?: string; as?: keyof JSX.IntrinsicElements; } /** * Safe renderer for Spool CMS content that prevents XSS attacks * and properly handles code blocks without execution. * * This component safely renders HTML content from Spool CMS by: * 1. Escaping HTML entities inside code blocks to prevent execution * 2. Basic HTML sanitization to remove dangerous elements * 3. Preventing script execution while preserving formatting * 4. Ensuring forms and other HTML in code examples display as text * * @example * ```tsx * import { SpoolContentRenderer } from '@spoolcms/nextjs'; * * export function BlogPost({ post }) { * return ( * <article> * <h1>{post.title}</h1> * <SpoolContentRenderer content={post.body} /> * </article> * ); * } * ``` */ export declare function SpoolContentRenderer({ content, className, as: Component }: SpoolContentProps): import("react/jsx-runtime").JSX.Element; /** * Alternative approach using iframe for maximum security * Use this if you need the highest level of security */ export declare function SpoolContentSecure({ content, className }: { content: string; className?: string; }): import("react/jsx-runtime").JSX.Element; export {};