diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 4b4948671..5cd7abe24 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -650,7 +650,7 @@ export interface AstroUserConfig { * @description * Pass [remark plugins](https://github.com/remarkjs/remark) to customize how your Markdown is built. You can import and apply the plugin function (recommended), or pass the plugin name as a string. * - * :::caution + * :::caution * Providing a list of plugins will **remove** our default plugins. To preserve these defaults, see the `extendDefaultPlugins` flag. * ::: * @@ -671,7 +671,7 @@ export interface AstroUserConfig { * @description * Pass [rehype plugins](https://github.com/remarkjs/remark-rehype) to customize how your Markdown's output HTML is processed. You can import and apply the plugin function (recommended), or pass the plugin name as a string. * - * :::caution + * :::caution * Providing a list of plugins will **remove** our default plugins. To preserve these defaults, see the `extendDefaultPlugins` flag. * ::: * diff --git a/packages/astro/test/astro-markdown-plugins.test.js b/packages/astro/test/astro-markdown-plugins.test.js index c65284177..b2958f817 100644 --- a/packages/astro/test/astro-markdown-plugins.test.js +++ b/packages/astro/test/astro-markdown-plugins.test.js @@ -14,8 +14,11 @@ async function buildFixture(config) { function remarkExamplePlugin() { return (tree) => { - tree.children.push({ type: 'paragraph', children: [{ type: 'text', value: 'Remark plugin applied!' }] }) - } + tree.children.push({ + type: 'paragraph', + children: [{ type: 'text', value: 'Remark plugin applied!' }], + }); + }; } describe('Astro Markdown plugins', () => { @@ -48,28 +51,26 @@ describe('Astro Markdown plugins', () => { const fixture = await buildFixture({ markdown: { remarkPlugins: [remarkExamplePlugin], - rehypePlugins: [ - [addClasses, { 'h1,h2,h3': 'title' }], - ], + rehypePlugins: [[addClasses, { 'h1,h2,h3': 'title' }]], extendDefaultPlugins, }, }); const html = await fixture.readFile('/with-gfm/index.html'); const $ = cheerio.load(html); - + // test 1: GFM autolink applied correctly if (extendDefaultPlugins === true) { expect($('a[href="https://example.com"]')).to.have.lengthOf(1); } else { expect($('a[href="https://example.com"]')).to.have.lengthOf(0); } - + // test 2: (sanity check) remark plugins still applied expect(html).to.include('Remark plugin applied!'); - + // test 3: (sanity check) rehype plugins still applied expect($('#github-flavored-markdown-test')).to.have.lengthOf(1); expect($('#github-flavored-markdown-test').hasClass('title')).to.equal(true); - }) + }); } });