@maizzle/framework
Version:
Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.
30 lines (29 loc) • 946 B
JavaScript
import { defu as defu$1 } from "defu";
import { format as format$1 } from "oxfmt";
//#region src/transformers/format.ts
const DEFAULT_OPTIONS = {
printWidth: 320,
htmlWhitespaceSensitivity: "ignore",
embeddedLanguageFormatting: "off"
};
/**
* Pretty-print an HTML string with `oxfmt`. Maizzle defaults
* (`printWidth: 320`, `htmlWhitespaceSensitivity: 'ignore'`,
* `embeddedLanguageFormatting: 'off'`) are merged underneath any options
* you pass.
*
* @param html HTML string to format.
* @param options [oxfmt `FormatConfig`](https://github.com/oxc-project/oxfmt).
* @returns The formatted HTML string.
*
* @example
* import { format } from '@maizzle/framework'
*
* const pretty = await format(html, { useTabs: true, tabWidth: 4 })
*/
async function format(html, options = {}) {
return (await format$1("input.html", html, defu$1(options, DEFAULT_OPTIONS))).code;
}
//#endregion
export { format };
//# sourceMappingURL=format.js.map