oh no where did astro go

This commit is contained in:
Cory LaViska
2024-04-17 11:20:27 -04:00
parent 8e5e039af8
commit 67b2888489
1189 changed files with 23848 additions and 35527 deletions

View File

@@ -0,0 +1,32 @@
import { format } from 'prettier';
import defaultOptions from '../../prettier.config.js';
/**
* Formats a string of code using Prettier.
*
* @param {string} code - The code to format.
* @param {*} options - Prettier options. Defaults are taken from the project's root config. See this page for more
* info: https://prettier.io/docs/en/options.html
*/
export async function formatCode(string, options) {
return await format(string, {
...defaultOptions,
...options
});
}
/**
* Eleventy plugin to format page HTML using Prettier.
*/
export function formatCodePlugin(options = {}) {
options = {
parser: 'html',
...options
};
return function (eleventyConfig) {
eleventyConfig.addTransform('format-code', content => {
return formatCode(content, options);
});
};
}