This is bold text.
'; * const markdown = htmlToMarkdown(html); * console.log(markdown); // "# Hello World\n\nThis is **bold** text." * ``` */ export declare function htmlToMarkdown(html: string, options?: HtmlToMarkdownOptions): string; /** * Converts Markdown content to HTML format * * @param markdown - The Markdown content to convert * @param options - Configuration options for conversion * @returns The converted HTML content * @throws SunsamaAuthError if input validation fails * * @example * ```typescript * const markdown = '# Hello World\n\nThis is **bold** text.'; * const html = markdownToHtml(markdown); * console.log(html); // "This is bold text.
" * ``` */ export declare function markdownToHtml(markdown: string, options?: MarkdownToHtmlOptions): string; /** * Sanitizes HTML content to prevent XSS attacks * This is a basic implementation - consider using a dedicated library like DOMPurify for production * * @param html - The HTML content to sanitize * @returns Sanitized HTML content */ export declare function sanitizeHtml(html: string): string; /** * Utility function to safely convert between HTML and Markdown with validation * * @param content - The content to convert * @param fromFormat - Source format ('html' or 'markdown') * @param toFormat - Target format ('html' or 'markdown') * @param options - Conversion options * @returns Converted content * @throws SunsamaAuthError if conversion fails or formats are invalid * * @example * ```typescript * const html = 'Hello world
'; * const markdown = convertContent(html, 'html', 'markdown'); * console.log(markdown); // "Hello **world**" * * const convertedBack = convertContent(markdown, 'markdown', 'html'); * console.log(convertedBack); // "Hello world
" * ``` */ export declare function convertContent(content: string, fromFormat: 'html' | 'markdown', toFormat: 'html' | 'markdown', options?: ConversionOptions): string; /** * Parses markdown content into formatted segments suitable for Yjs XmlText insertion. * * This function converts markdown text into an array of segments, where each segment * contains the text content and optional formatting attributes (bold, italic, link, etc.). * The segments can be used to insert rich text into a Yjs document with proper formatting. * * @param markdown - The markdown content to parse * @returns Array of formatted segments with text and Yjs-compatible attributes * * @example * ```typescript * const segments = parseMarkdownToSegments('This is **bold** and *italic* text'); * // Returns: * // [ * // { text: 'This is ' }, * // { text: 'bold', attributes: { bold: true } }, * // { text: ' and ' }, * // { text: 'italic', attributes: { italic: true } }, * // { text: ' text' } * // ] * * const linkSegments = parseMarkdownToSegments('Visit [Google](https://google.com)'); * // Returns: * // [ * // { text: 'Visit ' }, * // { text: 'Google', attributes: { link: 'https://google.com' } } * // ] * ``` */ export declare function parseMarkdownToSegments(markdown: string): FormattedSegment[]; /** * Parses markdown content into a document structure with block-level elements. * * This function converts markdown text into an array of document blocks, where each block * represents a block-level element (paragraph, blockquote, horizontal rule, etc.). * This structure is suitable for creating proper Yjs XmlElement hierarchies that match * Sunsama's rich text editor format. * * @param markdown - The markdown content to parse * @returns Array of document blocks representing the document structure * * @example * ```typescript * const blocks = parseMarkdownToBlocks('Hello **world**\n\n> A quote\n\n---'); * // Returns: * // [ * // { type: 'paragraph', segments: [{ text: 'Hello ' }, { text: 'world', attributes: { bold: true } }] }, * // { type: 'blockquote', children: [{ type: 'paragraph', segments: [{ text: 'A quote' }] }] }, * // { type: 'horizontalRule' } * // ] * ``` */ export declare function parseMarkdownToBlocks(markdown: string): DocumentBlock[]; //# sourceMappingURL=conversion.d.ts.map