import { MarkedOptions, MarkedExtension } from 'marked'; import TurndownService from 'turndown'; import { HtmlToTextOptions } from 'html-to-text'; export { HtmlToTextOptions as ToTextOptions } from 'html-to-text'; interface MarkdownFootnoteOptions { /** * The prefix ID for footnotes. Defaults to 'footnote-'. */ prefixId?: string; /** * The description of footnotes, used by aria-labeledby attribute. Defaults to 'Footnotes'. */ description?: string; /** * If set to true, it will place footnote reference in square brackets, like this: [1]. Defaults to false. */ refMarkers?: boolean; } interface FromMarkdownOptions extends MarkedOptions { footnotes?: boolean | MarkdownFootnoteOptions; inline?: boolean; } interface MarkdownExtension extends MarkedExtension { } declare function fromMarkdown(input: string, options?: FromMarkdownOptions): string | Promise; /** * Options to control the rendering of Markdown markup to HTML. * * @see {@link https://marked.js.org/demo} for syntax and rendering demo. * @see {@link https://github.github.com/gfm/} for Github-Flavored Markdown documentation. */ interface ToMarkdownOptions extends TurndownService.Options { gfm?: boolean; highlightedCodeBlock?: boolean; strikethrough?: boolean; tables?: boolean; taskListItems?: boolean; } /** * Parse Markdown text and return formatted HTML. * * @see {@link https://marked.js.org/demo} for syntax and rendering demo. * @see {@link https://github.github.com/gfm/} for Github-Flavored Markdown documentation. */ declare function toMarkdown(input: string, options?: ToMarkdownOptions): string; declare function toText(html: string, options?: string | HtmlToTextOptions): string; declare const textPresets: Record; interface FromTextOptions { /** * Encode entities * * @defaultValue: 'utf8' */ entities?: 'xml' | 'utf8' | 'html' | false; /** * Treat double-linefeeds (or any run of 2+ linefeeds) as paragraph separators * * @defaultValue: true */ paragraphs?: boolean; /** * Turn URLs in the text into clickable links * * @defaultValue: true */ urls?: boolean; } /** * Extremely simple conversion of plaintext to HTML: * * - Special characters are encoded * - Multiple sequential newlines are treated as paragraph separators * * For formatting or more complex structures, something like markdown makes a lot * more sense. Notably, single linebreaks are NOT converted to `
` tags, as * was sometimes done in the olden days of internet text. We may add that option * eventually, but for now, yuck. */ declare function fromText(text: string, options?: FromTextOptions): string; declare function linkify(input: string): string; declare function autop(text: string, br?: boolean): string; type FromRtfOptions = { paraBreaks?: string; paraTag?: string; template?: OutputTemplate; disableFonts?: boolean; fontSize?: number; bold?: boolean; italic?: boolean; underline?: boolean; strikethrough?: boolean; foreground?: RgbColor; background?: RgbColor; indent?: number; align?: 'left' | 'center' | 'right'; }; type OutputTemplate = (doc: any, defaults: FromRtfOptions, content: string) => string; type RgbColor = { red: number; blue: number; green: number; }; declare function fromRtf(input: string, options?: FromRtfOptions): Promise; /** * Options to control the rendering of BBCode markup to HTML. * * @see {@link https://www.bbcode.org/reference.php} for syntax guidelines. */ interface FromBBCodeOptions extends Record { /** * Convert single-line linebreaks to `
` */ newline?: boolean; /** * Generate paragraph tags */ paragraph?: boolean; /** * Discard unmatched BBCode tags */ cleanUnmatchable?: boolean; /** * Clean up HTML after conversion */ sanitizeHtml?: boolean; } /** * Parse BBCode text and return formatted HTML. * * @see {@link https://www.bbcode.org/reference.php} for syntax guidelines. */ declare function fromBbcode(input: string, options?: FromBBCodeOptions): string; /** * Options to control the rendering of Textile markup to HTML. * * @see {@link http://borgar.github.io/textile-js/} for syntax guidelines. */ interface FromTextileOptions extends Record { /** * Convert single-line linebreaks to `
` */ breaks?: boolean; } /** * Parse Textile text and return formatted HTML. * * @see {@link http://borgar.github.io/textile-js/} for syntax guidelines. */ declare function fromTextile(input: string, options?: FromTextileOptions): string; export { type FromBBCodeOptions, type FromMarkdownOptions, type FromRtfOptions, type FromTextOptions, type FromTextileOptions, type MarkdownExtension, type MarkdownFootnoteOptions, type ToMarkdownOptions, autop, fromBbcode, fromMarkdown, fromRtf, fromText, fromTextile, linkify, textPresets, toMarkdown, toText };