[ci] format

This commit is contained in:
bholmesdev 2022-07-20 18:16:33 +00:00 committed by fredkbot
parent 19433eb4a4
commit 74b0099cd1
2 changed files with 15 additions and 8 deletions

View file

@ -10,11 +10,14 @@ type WithExtends<T> = T | { extends: T };
type MdxOptions = {
remarkPlugins?: WithExtends<MdxRollupPluginOptions['remarkPlugins']>;
rehypePlugins?: WithExtends<MdxRollupPluginOptions['rehypePlugins']>;
}
};
const DEFAULT_REMARK_PLUGINS = [remarkGfm, remarkSmartypants];
function handleExtends<T>(config: WithExtends<T[] | undefined>, defaults: T[] = []): T[] | undefined {
function handleExtends<T>(
config: WithExtends<T[] | undefined>,
defaults: T[] = []
): T[] | undefined {
if (Array.isArray(config)) return config;
return [...defaults, ...(config?.extends ?? [])];

View file

@ -11,9 +11,11 @@ describe('MDX remark plugins', () => {
it('supports custom remark plugins - TOC', async () => {
const fixture = await loadFixture({
root: FIXTURE_ROOT,
integrations: [mdx({
remarkPlugins: [remarkToc],
})],
integrations: [
mdx({
remarkPlugins: [remarkToc],
}),
],
});
await fixture.build();
@ -41,9 +43,11 @@ describe('MDX remark plugins', () => {
it('preserves default GitHub-flavored markdown with "extends"', async () => {
const fixture = await loadFixture({
root: FIXTURE_ROOT,
integrations: [mdx({
remarkPlugins: { extends: [remarkToc] },
})],
integrations: [
mdx({
remarkPlugins: { extends: [remarkToc] },
}),
],
});
await fixture.build();