vfm.js/etc/vfm-js.api.md

7 KiB

API Report File for "vfm-js"

Do not edit this file. It is a report generated by API Extractor.


// @public (undocumented)
export const BOLD: (children: VfmInline[]) => NodeType<'bold'>;

// @public (undocumented)
export const CENTER: (children: VfmInline[]) => NodeType<'center'>;

// @public (undocumented)
export const CODE_BLOCK: (code: string, lang: string | null) => NodeType<'blockCode'>;

// @public (undocumented)
export const EMOJI_CODE: (name: string) => NodeType<'emojiCode'>;

// @public (undocumented)
export function extract(nodes: VfmNode[], predicate: (node: VfmNode) => boolean): VfmNode[];

// @public (undocumented)
export const FN: (name: string, args: VfmFn['props']['args'], children: VfmFn['children']) => NodeType<'fn'>;

// @public (undocumented)
export const HASHTAG: (value: string) => NodeType<'hashtag'>;

// @public (undocumented)
export const INLINE_CODE: (code: string) => NodeType<'inlineCode'>;

// @public (undocumented)
export function inspect(node: VfmNode, action: (node: VfmNode) => void): void;

// @public (undocumented)
export function inspect(nodes: VfmNode[], action: (node: VfmNode) => void): void;

// @public (undocumented)
export const ITALIC: (children: VfmInline[]) => NodeType<'italic'>;

// @public (undocumented)
export const LINK: (silent: boolean, url: string, children: VfmInline[]) => NodeType<'link'>;

// @public (undocumented)
export const MATH_BLOCK: (formula: string) => NodeType<'mathBlock'>;

// @public (undocumented)
export const MATH_INLINE: (formula: string) => NodeType<'mathInline'>;

// @public (undocumented)
export const MENTION: (username: string, host: string | null, acct: string) => NodeType<'mention'>;

// @public (undocumented)
export const N_URL: (value: string, brackets?: boolean) => NodeType<'url'>;

// @public (undocumented)
export type NodeType<T extends VfmNode['type']> = T extends 'quote' ? VfmQuote : T extends 'search' ? VfmSearch : T extends 'blockCode' ? VfmCodeBlock : T extends 'mathBlock' ? VfmMathBlock : T extends 'center' ? VfmCenter : T extends 'unicodeEmoji' ? VfmUnicodeEmoji : T extends 'emojiCode' ? VfmEmojiCode : T extends 'bold' ? VfmBold : T extends 'small' ? VfmSmall : T extends 'italic' ? VfmItalic : T extends 'strike' ? VfmStrike : T extends 'inlineCode' ? VfmInlineCode : T extends 'mathInline' ? VfmMathInline : T extends 'mention' ? VfmMention : T extends 'hashtag' ? VfmHashtag : T extends 'url' ? VfmUrl : T extends 'link' ? VfmLink : T extends 'fn' ? VfmFn : T extends 'plain' ? VfmPlain : T extends 'text' ? VfmText : never;

// @public (undocumented)
export function parse(input: string, opts?: Partial<{
    nestLimit: number;
}>): VfmNode[];

// @public (undocumented)
export function parseSimple(input: string): VfmSimpleNode[];

// @public (undocumented)
export const PLAIN: (text: string) => NodeType<'plain'>;

// @public (undocumented)
export const QUOTE: (children: VfmNode[]) => NodeType<'quote'>;

// @public (undocumented)
export const SEARCH: (query: string, content: string) => NodeType<'search'>;

// @public (undocumented)
export const SMALL: (children: VfmInline[]) => NodeType<'small'>;

// @public (undocumented)
export const STRIKE: (children: VfmInline[]) => NodeType<'strike'>;

// @public (undocumented)
export const TEXT: (value: string) => NodeType<'text'>;

// @public (undocumented)
function toString_2(tree: VfmNode[]): string;

// @public (undocumented)
function toString_2(node: VfmNode): string;
export { toString_2 as toString }

// @public (undocumented)
export const UNI_EMOJI: (value: string) => NodeType<'unicodeEmoji'>;

// @public (undocumented)
export type VfmBlock = VfmQuote | VfmSearch | VfmCodeBlock | VfmMathBlock | VfmCenter;

// @public (undocumented)
export type VfmBold = {
    type: 'bold';
    props?: Record<string, unknown>;
    children: VfmInline[];
};

// @public (undocumented)
export type VfmCenter = {
    type: 'center';
    props?: Record<string, unknown>;
    children: VfmInline[];
};

// @public (undocumented)
export type VfmCodeBlock = {
    type: 'blockCode';
    props: {
        code: string;
        lang: string | null;
    };
    children?: [];
};

// @public (undocumented)
export type VfmEmojiCode = {
    type: 'emojiCode';
    props: {
        name: string;
    };
    children?: [];
};

// @public (undocumented)
export type VfmFn = {
    type: 'fn';
    props: {
        name: string;
        args: Record<string, string | true>;
    };
    children: VfmInline[];
};

// @public (undocumented)
export type VfmHashtag = {
    type: 'hashtag';
    props: {
        hashtag: string;
    };
    children?: [];
};

// @public (undocumented)
export type VfmInline = VfmUnicodeEmoji | VfmEmojiCode | VfmBold | VfmSmall | VfmItalic | VfmStrike | VfmInlineCode | VfmMathInline | VfmMention | VfmHashtag | VfmUrl | VfmLink | VfmFn | VfmPlain | VfmText;

// @public (undocumented)
export type VfmInlineCode = {
    type: 'inlineCode';
    props: {
        code: string;
    };
    children?: [];
};

// @public (undocumented)
export type VfmItalic = {
    type: 'italic';
    props?: Record<string, unknown>;
    children: VfmInline[];
};

// @public (undocumented)
export type VfmLink = {
    type: 'link';
    props: {
        silent: boolean;
        url: string;
    };
    children: VfmInline[];
};

// @public (undocumented)
export type VfmMathBlock = {
    type: 'mathBlock';
    props: {
        formula: string;
    };
    children?: [];
};

// @public (undocumented)
export type VfmMathInline = {
    type: 'mathInline';
    props: {
        formula: string;
    };
    children?: [];
};

// @public (undocumented)
export type VfmMention = {
    type: 'mention';
    props: {
        username: string;
        host: string | null;
        acct: string;
    };
    children?: [];
};

// @public (undocumented)
export type VfmNode = VfmBlock | VfmInline;

// @public (undocumented)
export type VfmPlain = {
    type: 'plain';
    props?: Record<string, unknown>;
    children: VfmText[];
};

// @public (undocumented)
export type VfmQuote = {
    type: 'quote';
    props?: Record<string, unknown>;
    children: VfmNode[];
};

// @public (undocumented)
export type VfmSearch = {
    type: 'search';
    props: {
        query: string;
        content: string;
    };
    children?: [];
};

// @public (undocumented)
export type VfmSimpleNode = VfmUnicodeEmoji | VfmEmojiCode | VfmText | VfmPlain;

// @public (undocumented)
export type VfmSmall = {
    type: 'small';
    props?: Record<string, unknown>;
    children: VfmInline[];
};

// @public (undocumented)
export type VfmStrike = {
    type: 'strike';
    props?: Record<string, unknown>;
    children: VfmInline[];
};

// @public (undocumented)
export type VfmText = {
    type: 'text';
    props: {
        text: string;
    };
    children?: [];
};

// @public (undocumented)
export type VfmUnicodeEmoji = {
    type: 'unicodeEmoji';
    props: {
        emoji: string;
    };
    children?: [];
};

// @public (undocumented)
export type VfmUrl = {
    type: 'url';
    props: {
        url: string;
        brackets?: boolean;
    };
    children?: [];
};

// (No @packageDocumentation comment for this package)