import { BaseInlineTokenizer, IBaseInlineTokenizerProps, IInlineTokenizer, IMatchInlineHookCreator, IParseInlineHookCreator, IPartialInlineToken, ITokenDelimiter, ITokenizer } from "@yozora/core-tokenizer"; import { Image, ImageType, Node } from "@yozora/ast"; import { INodeInterval } from "@yozora/character"; //#region src/types.d.ts type T = ImageType; type INode = Image; declare const uniqueName = "@yozora/tokenizer-image"; /** * An image token. */ interface IToken extends IPartialInlineToken { /** * Link destination interval. */ destinationContent?: INodeInterval; /** * Link title interval. */ titleContent?: INodeInterval; } interface IDelimiter extends ITokenDelimiter { /** * IDelimiter type. */ type: 'opener' | 'closer'; /** * link destination */ destinationContent?: INodeInterval; /** * link title */ titleContent?: INodeInterval; } type IThis = ITokenizer; type ITokenizerProps = Partial; //#endregion //#region src/match.d.ts /** * Syntax for images is like the syntax for links, with one difference. * Instead of link text, we have an image description. * The rules for this are the same as for link text, except that * * a) an image description starts with '![' rather than '[', and * b) an image description may contain links. * * An image description has inline elements as its contents. When an image is * rendered to HTML, this is standardly used as the image’s alt attribute. * * ------ * * A 'opener' type delimiter is one of the following forms: * * - '![' * * A 'closer' type delimiter is one of the following forms: * * - '](url)' * - '](url "title")' * - ']()' * - ']( "title")' * * @see https://github.com/syntax-tree/mdast#image * @see https://github.github.com/gfm/#images */ declare const match: IMatchInlineHookCreator; //#endregion //#region src/parse.d.ts declare const parse: IParseInlineHookCreator; //#endregion //#region src/tokenizer.d.ts /** * Lexical Analyzer for InlineImage. * @see https://github.com/syntax-tree/mdast#image * @see https://github.github.com/gfm/#images */ export declare class ImageTokenizer extends BaseInlineTokenizer implements IInlineTokenizer { constructor(props?: ITokenizerProps); readonly match: IMatchInlineHookCreator; readonly parse: IParseInlineHookCreator; } //#endregion //#region src/util.d.ts /** * calc alt * An image description has inline elements as its contents. When an image * is rendered to HTML, this is standardly used as the image’s alt attribute * @see https://github.github.com/gfm/#example-582 */ export declare function calcImageAlt(nodes: readonly Node[]): string; //#endregion export { type IThis as IImageHookContext, type IToken as IImageToken, type ITokenizerProps as IImageTokenizerProps, ImageTokenizer as default, uniqueName as ImageTokenizerName, match as imageMatch, parse as imageParse }; export {};