UNPKG

myst-cli

Version:
37 lines 1.62 kB
import type { GenericParent } from 'myst-common'; import type { LinkTransformer } from 'myst-transforms'; import type { Link } from 'myst-spec-ext'; import type { VFile } from 'vfile'; import type { ISession } from '../session/types.js'; import type { ExternalLinkResult } from '../store/types.js'; export declare function checkLink(session: ISession, url: string): Promise<ExternalLinkResult>; type LinkInfo = { url: string; title?: string; description?: string; thumbnail?: string; }; export type LinkLookup = Record<string, LinkInfo>; /** * Compute link node file path relative to site root (currently, only the working directory) * * If path has no extension, this function looks for .md then .ipynb. * If a '#target' is present at the end of the path, it is maintained. * If file does not exists, returns undefined. * * @param pathFromLink Path from link node URL relative to file where it is defined * @param file File where link is defined * @param sitePath Root path of site / session; from here all relative paths in the store are defined */ export declare function fileFromRelativePath(pathFromLink: string, file?: string): string | undefined; export declare class StaticFileTransformer implements LinkTransformer { protocol: string; session: ISession; filePath: string; constructor(session: ISession, filePath: string); test(url?: string): boolean; transform(link: Link, file: VFile): boolean; } export declare function checkLinksTransform(session: ISession, file: string, mdast: GenericParent): Promise<string[]>; export {}; //# sourceMappingURL=links.d.ts.map