/** * Parse entities. * * @template {typeof globalThis} WarningContext * @template {typeof globalThis} ReferenceContext * @template {typeof globalThis} TextContext * @param {string} value * @param {Partial>} [options={}] */ export function parseEntities< WarningContext extends typeof globalThis, ReferenceContext extends typeof globalThis, TextContext extends typeof globalThis >( value: string, options?: Partial< ParseEntitiesOptions > ): string export type ParseEntitiesOptions< WarningContext extends typeof globalThis, ReferenceContext extends typeof globalThis, TextContext extends typeof globalThis > = { /** * Additional character to accept. This allows other characters, without error, when following an ampersand */ additional?: string /** * Whether to parse `value` as an attribute value */ attribute?: boolean /** * Whether to allow non-terminated entities. For example, `©cat` for `©cat`. This behaviour is spec-compliant but can lead to unexpected results */ nonTerminated?: boolean /** * Starting `position` of `value` (`Point` or `Position`). Useful when dealing with values nested in some sort of syntax tree */ position?: Position | Point /** * Context used when calling `warning` */ warningContext: WarningContext /** * Warning handler */ warning: WarningHandler /** * Context used when calling `reference` */ referenceContext: ReferenceContext /** * Reference handler */ reference: ReferenceHandler /** * Context used when calling `text` */ textContext: TextContext /** * Text handler */ text: TextHandler } export type Position = { start: Point end?: Point indent?: number[] } export type Point = { line: number column: number offset: number } export type WarningHandler = () => any export type ReferenceHandler = () => any export type TextHandler = () => any