UNPKG

md-to-svelte

Version:

Convert markdown file to svelte.

65 lines (64 loc) 2.1 kB
/** Page meta tags (required) */ export type MetaData = { [key: string]: string; }; /** Current page being created */ export type CurrentPage = { /** Custom js/ts code to add to page */ jsCode: string; /** Current to to add to page body (content) */ code: string; /** Custom css code to add to page */ css: string; /** Page meta data tags (required) */ metaData: MetaData; /** Headers founded in file */ headers: { id: string; text: string; }[]; }; /** Data returned from function */ export type Result = { /** Page layout key */ [key: string]: { /** Page link (href) */ href: string; /** Page title */ title: string; /** Page description */ description: string; /** Indicate if it's a new feature (add badge next to link) */ new: boolean; /** Headers founded in file */ headers: { id: string; text: string; }[]; /** All meta data from file */ [key: string]: any; }[]; }; /** Function options */ export type Options = { /** App name, so we can use to add app name after title example title here | appName */ appName: string; /** Website domain, it's use to add to meta data url property */ domainUrl: string; /** Default image to use when there was not image founded on markdown meta tag */ defaultImage: string; /** If set to true, it will delete everything on parent folder example /docs/ will delete everything in folder docs */ devMode?: boolean; }; /** Convert markdown file to svelte * @param outPutDir - Directory to save converted markdown */ export default function mdToSvelte(outPutDir: `src/routes/${string}`, options: Options): Promise<Result>; /** Convert markdown file to svelte * @param outPutDir - Directory to save converted markdown */ export declare function viteMdToSvelte(outPutDir: `src/routes/${string}`, options: Options): Promise<{ name: string; handleHotUpdate(data: { file: string; server: any; }): void; }>;