export interface GrammarRule { regexp: RegExp; replacement: string; labelPlaceholder?: number; } export interface HTMLBlockRule { start: RegExp; end: RegExp | false; paraInterrupt: boolean; } export interface InlineCommand { type: 'inline'; className: string; set: { pre: string; post: string; }; unset: { prePattern: RegExp; postPattern: RegExp; }; } export interface LineCommand { type: 'line'; className: string; set: { pattern: RegExp; replacement: string; }; unset: { pattern: RegExp; replacement: string; }; } export type Command = InlineCommand | LineCommand; export declare const punctuationLeading: RegExp; export declare const punctuationTrailing: RegExp; /** * This is CommonMark's block grammar, but we're ignoring nested blocks here. */ export declare const lineGrammar: Record; /** * HTML blocks have multiple different classes of opener and closer. This array defines all the cases */ export declare const htmlBlockGrammar: HTMLBlockRule[]; /** * Structure of the object: * Top level entries are rules, each consisting of a regular expressions (in string format) as well as a replacement. * In the regular expressions, replacements from the object 'replacements' will be processed before compiling into the property regexp. */ export declare const inlineGrammar: Record; /** * Creates a merged inline grammar by combining the default inline grammar with custom rules. * Custom rules are processed and their regexp patterns are expanded with replacements. * @param customRules - Object containing custom inline grammar rules * @returns Merged inline grammar object */ export declare function createMergedInlineGrammar(customRules?: Record): Record; /** * Escapes HTML special characters (<, >, and &) in the string. * @param {string} string The raw string to be escaped * @returns {string} The string, ready to be used in HTML */ export declare function htmlescape(string: string): string; /** * Contains the commands that can be sent to the editor. Contains objects with a name representing the name of the command. * Each of the objects contains the following keys: * * - type: Can be either inline (for inline formatting) or line (for block / line formatting). * - className: Used to determine whether the command is active at a given position. * For line formatting, this looks at the class of the line element. For inline elements, tries to find an enclosing element with that class. * - set / unset: Contain instructions how to set and unset the command. For line type commands, both consist of a pattern and replacement that * will be applied to each line (using String.replace). For inline type commands, the set object contains a pre and post string which will * be inserted before and after the selection. The unset object contains a prePattern and a postPattern. Both should be regular expressions and * they will be applied to the portion of the line before and after the selection (using String.replace, with an empty replacement string). */ export declare const commands: Record;