import { BaseInlineTokenizer, IBaseInlineTokenizerProps, IInlineTokenizer, IMatchInlineHookCreator, IParseInlineHookCreator, IPartialInlineToken, ITokenDelimiter, ITokenizer } from "@yozora/core-tokenizer"; import { Association, LinkReference, LinkReferenceType, Reference } from "@yozora/ast"; //#region src/types.d.ts declare const uniqueName = "@yozora/tokenizer-link-reference"; type T = LinkReferenceType; type INode = LinkReference; interface IToken extends IPartialInlineToken, Association, Reference {} interface ILinkReferenceDelimiterBracket { /** * Start index of a bracket pair. */ startIndex: number; /** * End index of a bracket pair. */ endIndex: number; /** * Reference link label. */ label?: string; /** * Reference link identifier. */ identifier?: string; } interface IDelimiter extends ITokenDelimiter { brackets: ILinkReferenceDelimiterBracket[]; } type IThis = ITokenizer; type ITokenizerProps = Partial; //#endregion //#region src/match.d.ts /** * There are three kinds of reference links: * - full: A full reference link consists of a link text immediately followed * by a link label that matches a link reference definition elsewhere in the * document. * * A link label begins with a left bracket '[' and ends with the first right * bracket ']' that is not backslash-escaped. Between these brackets there * must be at least one non-whitespace character. Unescaped square bracket * characters are not allowed inside the opening and closing square brackets * of link labels. A link label can have at most 999 characters inside the * square brackets. * * One label matches another just in case their normalized forms are equal. * To normalize a label, strip off the opening and closing brackets, perform * the Unicode case fold, strip leading and trailing whitespace and collapse * consecutive internal whitespace to a single space. If there are multiple * matching reference link definitions, the one that comes first in the * document is used. (It is desirable in such cases to emit a warning.) * * - collapsed: A collapsed reference link consists of a link label that * matches a link reference definition elsewhere in the document, followed * by the string '[]'. The contents of the first link label are parsed as * inlines, which are used as the link’s text. The link’s URI and title are * provided by the matching reference link definition. * Thus, '[foo][]' is equivalent to '[foo][foo]'. * * - shortcut (not support): A shortcut reference link consists of a link label * that matches a link reference definition elsewhere in the document and is * not followed by '[]' or a link label. The contents of the first link label * are parsed as inlines, which are used as the link’s text. The link’s URI * and title are provided by the matching link reference definition. * Thus, '[foo]' is equivalent to '[foo][]'. * * ------ * * A 'opener' type delimiter is one of the following forms: * * - '[' * - '[identifier][' * - '[identifier][identifier2]...[identifierN][' * * A 'closer' type delimiter is one of the following forms: * * - '][identifier]' * - '][identifier][]' * - '][identifier][identifier2]....[identifierN]' * - '][identifier][identifier2]....[identifierN][]' * * A 'both' type delimiter is one of the following forms: * * - '][identifier][' * - '][identifier][identifier2]...[identifierN][' * * A 'full' type delimiter is one of the following forms: * * - '[]' * - '[identifier]' * - '[identifier][]' * - '][identifier][identifier2]....[identifierN]' * - '][identifier][identifier2]....[identifierN][]' * * @see https://github.com/syntax-tree/mdast#linkreference * @see https://github.github.com/gfm/#reference-link */ declare const match: IMatchInlineHookCreator; //#endregion //#region src/parse.d.ts declare const parse: IParseInlineHookCreator; //#endregion //#region src/tokenizer.d.ts /** * Lexical Analyzer for Node. * @see https://github.com/syntax-tree/mdast#linkreference * @see https://github.github.com/gfm/#reference-link */ export declare class LinkReferenceTokenizer extends BaseInlineTokenizer implements IInlineTokenizer { constructor(props?: ITokenizerProps); readonly match: IMatchInlineHookCreator; readonly parse: IParseInlineHookCreator; } //#endregion export { type ILinkReferenceDelimiterBracket, type IThis as ILinkReferenceHookContext, type IToken as ILinkReferenceToken, type ITokenizerProps as ILinkReferenceTokenizerProps, LinkReferenceTokenizer as default, uniqueName as LinkReferenceTokenizerName, match as linkReferenceMatch, parse as linkReferenceParse }; export {};