UNPKG

@spoolcms/nextjs

Version:

The beautiful headless CMS for Next.js developers

48 lines (47 loc) 1.23 kB
/** * MarkdownField class provides an intuitive interface for markdown fields * Defaults to HTML output but allows access to raw markdown */ export declare class MarkdownField { private _html; private _markdown; constructor(markdown: string, html?: string); /** * Default behavior: return HTML when field is used directly * This allows: <div dangerouslySetInnerHTML={{ __html: post.body }} /> * Or even simpler: <div>{post.body}</div> (though this won't render HTML) */ toString(): string; /** * Explicit HTML access */ get html(): string; /** * Explicit markdown access */ get markdown(): string; /** * For JSON serialization */ toJSON(): string; /** * For template literal usage */ valueOf(): string; /** * Check if field has content */ get isEmpty(): boolean; /** * Get length of HTML content */ get length(): number; } /** * Create a MarkdownField instance */ export declare function createMarkdownField(markdown: string, html?: string): MarkdownField; /** * Check if a value is a MarkdownField */ export declare function isMarkdownField(value: any): value is MarkdownField;