summaryrefslogtreecommitdiff
path: root/packages/integrations/mdx/test/mdx-remark-plugins.test.js
diff options
context:
space:
mode:
authorGravatar Ben Holmes <hey@bholmes.dev> 2022-08-30 13:38:35 -0400
committerGravatar GitHub <noreply@github.com> 2022-08-30 13:38:35 -0400
commit8f8dff4d339a3a12ee155d81a97132032ef3b622 (patch)
tree0581df292a1003288b0dbd7a3f9246f25b5a3cce /packages/integrations/mdx/test/mdx-remark-plugins.test.js
parente905784bf12ef45093078404d3d07f01e32638ca (diff)
downloadastro-8f8dff4d339a3a12ee155d81a97132032ef3b622.tar.gz
astro-8f8dff4d339a3a12ee155d81a97132032ef3b622.tar.zst
astro-8f8dff4d339a3a12ee155d81a97132032ef3b622.zip
[MDX] Extend Markdown plugin config, with customization options (#4504)
* test: new combined remark / rehype suite * fix: use with-plugins fixture * chore: remove old mdx plugin tests * docs: add JS docs * docs: update README with thorough example * chore: changeset * fix: add "extends" error message * fix: ignore string-based plugins in md * feat: add warning log for string plugins * docs: highlight `extendPlugins` Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * nit: highlight "extendPlugins" * fix: md plugins type check * chore: "defaults" -> "astroDefaults" * nit: info log when inheriting markdown plugins * refactor: one big log on new behavior * dan: dan nit Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Diffstat (limited to 'packages/integrations/mdx/test/mdx-remark-plugins.test.js')
-rw-r--r--packages/integrations/mdx/test/mdx-remark-plugins.test.js62
1 files changed, 0 insertions, 62 deletions
diff --git a/packages/integrations/mdx/test/mdx-remark-plugins.test.js b/packages/integrations/mdx/test/mdx-remark-plugins.test.js
deleted file mode 100644
index dad976989..000000000
--- a/packages/integrations/mdx/test/mdx-remark-plugins.test.js
+++ /dev/null
@@ -1,62 +0,0 @@
-import mdx from '@astrojs/mdx';
-
-import { expect } from 'chai';
-import { parseHTML } from 'linkedom';
-import { loadFixture } from '../../../astro/test/test-utils.js';
-import remarkToc from 'remark-toc';
-
-const FIXTURE_ROOT = new URL('./fixtures/mdx-remark-plugins/', import.meta.url);
-
-describe('MDX remark plugins', () => {
- it('supports custom remark plugins - TOC', async () => {
- const fixture = await loadFixture({
- root: FIXTURE_ROOT,
- integrations: [
- mdx({
- remarkPlugins: [remarkToc],
- }),
- ],
- });
- await fixture.build();
-
- const html = await fixture.readFile('/with-toc/index.html');
- const { document } = parseHTML(html);
-
- const tocLink1 = document.querySelector('ul a[href="#section-1"]');
- expect(tocLink1).to.not.be.null;
- });
-
- it('applies GitHub-flavored markdown by default', async () => {
- const fixture = await loadFixture({
- root: FIXTURE_ROOT,
- integrations: [mdx()],
- });
- await fixture.build();
-
- const html = await fixture.readFile('/with-gfm/index.html');
- const { document } = parseHTML(html);
-
- const autoGenLink = document.querySelector('a[href="https://example.com"]');
- expect(autoGenLink).to.not.be.null;
- });
-
- it('preserves default GitHub-flavored markdown with "extends"', async () => {
- const fixture = await loadFixture({
- root: FIXTURE_ROOT,
- integrations: [
- mdx({
- remarkPlugins: { extends: [remarkToc] },
- }),
- ],
- });
- await fixture.build();
-
- const html = await fixture.readFile('/with-toc/index.html');
- const { document } = parseHTML(html);
-
- const tocLink1 = document.querySelector('ul a[href="#section-1"]');
- expect(tocLink1).to.not.be.null;
- const autoGenLink = document.querySelector('a[href="https://handle-me-gfm.com"]');
- expect(autoGenLink).to.not.be.null;
- });
-});