[ci] format
This commit is contained in:
parent
19433eb4a4
commit
74b0099cd1
2 changed files with 15 additions and 8 deletions
|
@ -10,11 +10,14 @@ type WithExtends<T> = T | { extends: T };
|
||||||
type MdxOptions = {
|
type MdxOptions = {
|
||||||
remarkPlugins?: WithExtends<MdxRollupPluginOptions['remarkPlugins']>;
|
remarkPlugins?: WithExtends<MdxRollupPluginOptions['remarkPlugins']>;
|
||||||
rehypePlugins?: WithExtends<MdxRollupPluginOptions['rehypePlugins']>;
|
rehypePlugins?: WithExtends<MdxRollupPluginOptions['rehypePlugins']>;
|
||||||
}
|
};
|
||||||
|
|
||||||
const DEFAULT_REMARK_PLUGINS = [remarkGfm, remarkSmartypants];
|
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;
|
if (Array.isArray(config)) return config;
|
||||||
|
|
||||||
return [...defaults, ...(config?.extends ?? [])];
|
return [...defaults, ...(config?.extends ?? [])];
|
||||||
|
|
|
@ -11,9 +11,11 @@ describe('MDX remark plugins', () => {
|
||||||
it('supports custom remark plugins - TOC', async () => {
|
it('supports custom remark plugins - TOC', async () => {
|
||||||
const fixture = await loadFixture({
|
const fixture = await loadFixture({
|
||||||
root: FIXTURE_ROOT,
|
root: FIXTURE_ROOT,
|
||||||
integrations: [mdx({
|
integrations: [
|
||||||
remarkPlugins: [remarkToc],
|
mdx({
|
||||||
})],
|
remarkPlugins: [remarkToc],
|
||||||
|
}),
|
||||||
|
],
|
||||||
});
|
});
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
|
|
||||||
|
@ -41,9 +43,11 @@ describe('MDX remark plugins', () => {
|
||||||
it('preserves default GitHub-flavored markdown with "extends"', async () => {
|
it('preserves default GitHub-flavored markdown with "extends"', async () => {
|
||||||
const fixture = await loadFixture({
|
const fixture = await loadFixture({
|
||||||
root: FIXTURE_ROOT,
|
root: FIXTURE_ROOT,
|
||||||
integrations: [mdx({
|
integrations: [
|
||||||
remarkPlugins: { extends: [remarkToc] },
|
mdx({
|
||||||
})],
|
remarkPlugins: { extends: [remarkToc] },
|
||||||
|
}),
|
||||||
|
],
|
||||||
});
|
});
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue