diff options
author | 2023-01-03 17:12:47 -0500 | |
---|---|---|
committer | 2023-01-03 17:12:47 -0500 | |
commit | a9c2920264e36cc5dc05f4adc1912187979edb0d (patch) | |
tree | 0a1987beb45f2c9a3670ee6122483bea81839139 /packages/integrations/mdx/test/mdx-syntax-highlighting.test.js | |
parent | 163a9a9d0ef8b08a71033e719ba06ff63cd2df60 (diff) | |
download | astro-a9c2920264e36cc5dc05f4adc1912187979edb0d.tar.gz astro-a9c2920264e36cc5dc05f4adc1912187979edb0d.tar.zst astro-a9c2920264e36cc5dc05f4adc1912187979edb0d.zip |
Markdown and MDX configuration rework (#5684)
* feat: change extendDefaults -> gfm
* deps: remove smartypants from md/remark
* tests: update markdown plugin tests
* fix: borked lockfile
* feat: allow all Markdown options in MDX config, with extend
* deps: remove smartypants from MDX
* chore: remove unused `mode` property
* chore: remark rehype types
* chore: dead code
* fix: order of default config properties
* refactor: move md defaults to remark
* fix: RemarkRehype type
* fix: apply defaults based on MD defaults
* chore: update plugin tests
* chore: add syntaxHighlight test
* refactor: remove drafts from config defaults
* docs: new MDX config options
* chore: add changeset
* edit: test both extends for syntax highlight
* refactor: remove MDX config deep merge
* docs: update README and changeset
* edit: avoid -> disable
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* edit: `drafts` clarification
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* edit: remove "scare quotes"
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
* docs: MDX config options redraft
* docs: add migration
* chore: changeset heading levels
* refactor: githubFlavoredMarkdown -> gfm
* chore: remove unused imports
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Diffstat (limited to 'packages/integrations/mdx/test/mdx-syntax-highlighting.test.js')
-rw-r--r-- | packages/integrations/mdx/test/mdx-syntax-highlighting.test.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js b/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js index 32c6bcd04..d420faabc 100644 --- a/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js +++ b/packages/integrations/mdx/test/mdx-syntax-highlighting.test.js @@ -67,6 +67,32 @@ describe('MDX syntax highlighting', () => { const prismCodeBlock = document.querySelector('pre.language-astro'); expect(prismCodeBlock).to.not.be.null; }); + + for (const extendMarkdownConfig of [true, false]) { + it(`respects syntaxHighlight when extendMarkdownConfig = ${extendMarkdownConfig}`, async () => { + const fixture = await loadFixture({ + root: FIXTURE_ROOT, + markdown: { + syntaxHighlight: 'shiki', + }, + integrations: [ + mdx({ + extendMarkdownConfig, + syntaxHighlight: 'prism', + }), + ], + }); + await fixture.build(); + + const html = await fixture.readFile('/index.html'); + const { document } = parseHTML(html); + + const shikiCodeBlock = document.querySelector('pre.astro-code'); + expect(shikiCodeBlock, 'Markdown config syntaxHighlight used unexpectedly').to.be.null; + const prismCodeBlock = document.querySelector('pre.language-astro'); + expect(prismCodeBlock).to.not.be.null; + }); + } }); it('supports custom highlighter - shiki-twoslash', async () => { |