myst-cli
Version:
Command line tools for MyST
45 lines • 1.59 kB
TypeScript
export declare enum ImageExtensions {
png = ".png",
jpg = ".jpg",
jpeg = ".jpeg",
svg = ".svg",
gif = ".gif",
tiff = ".tiff",
tif = ".tif",
pdf = ".pdf",
eps = ".eps",
webp = ".webp",
mp4 = ".mp4",// A moving image!
mov = ".mov",
avi = ".avi"
}
export declare const KNOWN_IMAGE_EXTENSIONS: ImageExtensions[];
export declare const KNOWN_VIDEO_EXTENSIONS: string[];
export declare const VALID_FILE_EXTENSIONS: string[];
export declare const KNOWN_FAST_BUILDS: Set<string>;
/** Return true if file has a valid extension for MyST content */
export declare function isValidFile(file: string): boolean;
/**
* Parse a file path into its constituent parts
*
* Handles multi-dot extensions
*/
export declare function parseFilePath(file: string): {
dir: string;
name: string;
ext: string;
};
/**
* Given a file with resolved path and filename, match to md, ipynb, or tex files
*
* If the file already has an extension and exists, it is returned as is.
* If the file with any of the extensions .md, .ipynb, .myst.json, or .tex appended exists,
* the existing file is returned.
*
* This will log an error if no match is found or multiple valid matches are found.
* (In the latter case, the first match is still returned.)
* This will log a warning if the given file did not have an extension and required resolution.
*
*/
export declare function resolveExtension(file: string, warnFn?: (message: string, level: 'warn' | 'error', note?: string) => void): string | undefined;
//# sourceMappingURL=resolveExtension.d.ts.map