UNPKG

@mdfriday/foundry

Version:

The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.

33 lines (32 loc) 1.83 kB
type SlugLike<T> = string & { __brand: T; }; export type FilePath = SlugLike<"filepath">; export declare function isFilePath(s: string): s is FilePath; export type FullSlug = SlugLike<"full">; export declare function isFullSlug(s: string): s is FullSlug; export type SimpleSlug = SlugLike<"simple">; export declare function isSimpleSlug(s: string): s is SimpleSlug; export type RelativeURL = SlugLike<"relative">; export declare function isRelativeURL(s: string): s is RelativeURL; export declare function isAbsoluteURL(s: string): boolean; export declare function slugifyFilePath(fp: FilePath | string, excludeExt?: boolean): FullSlug; export declare function simplifySlug(fp: FullSlug | string): SimpleSlug; export declare function transformInternalLink(link: string): RelativeURL; export declare function pathToRoot(slug: FullSlug | string): RelativeURL; export declare function resolveRelative(current: FullSlug | string, target: FullSlug | SimpleSlug | string): RelativeURL; export declare function splitAnchor(link: string): [string, string]; export declare function slugTag(tag: string): string; export declare function joinSegments(...args: string[]): string; export declare function getAllSegmentPrefixes(tags: string): string[]; export interface TransformOptions { strategy: "absolute" | "relative" | "shortest"; allSlugs: string[]; } export declare function transformLink(src: string, target: string, opts: TransformOptions): RelativeURL; export declare function isFolderPath(fplike: string): boolean; export declare function endsWith(s: string, suffix: string): boolean; export declare function trimSuffix(s: string, suffix: string): string; export declare function getFileExtension(s: string): string | undefined; export declare function stripSlashes(s: string, onlyStripPrefix?: boolean): string; export {};