ghom-eval
Version:
24 lines (23 loc) • 605 B
TypeScript
import prettier from "prettier";
import prettify from "ghom-prettify";
export interface Code {
lang?: string;
content: string;
}
export declare const code: {
pattern: RegExp;
/**
* extract the code from code block and return code
*/
parse(raw: string): Code | undefined;
/**
* inject the code in the code block and return code block
*/
stringify({ lang, content, format, }: Code & {
format?: true | prettier.Options;
}): Promise<string>;
/**
* format the code using prettier and return it
*/
format: typeof prettify.format;
};