Home / File/ mdx-syntax-highlighting.test.js — astro Source File

mdx-syntax-highlighting.test.js — astro Source File

Architecture documentation for mdx-syntax-highlighting.test.js, a javascript file in the astro codebase. 8 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  6e951d9c_c380_852e_a8dc_24658d70674d["mdx-syntax-highlighting.test.js"]
  0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"]
  6e951d9c_c380_852e_a8dc_24658d70674d --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15
  dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"]
  6e951d9c_c380_852e_a8dc_24658d70674d --> dd4f09ce_3fd7_8295_f616_8876cda4555c
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  6e951d9c_c380_852e_a8dc_24658d70674d --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  6e951d9c_c380_852e_a8dc_24658d70674d --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  b05fd4c1_a3ee_3301_adcd_43b49bae78f1["mdx"]
  6e951d9c_c380_852e_a8dc_24658d70674d --> b05fd4c1_a3ee_3301_adcd_43b49bae78f1
  cb315bcc_59d8_fa19_79aa_5da7cd3730c5["linkedom"]
  6e951d9c_c380_852e_a8dc_24658d70674d --> cb315bcc_59d8_fa19_79aa_5da7cd3730c5
  124cae92_e3c9_39b8_0b27_a015f444efdb["rehype-pretty-code"]
  6e951d9c_c380_852e_a8dc_24658d70674d --> 124cae92_e3c9_39b8_0b27_a015f444efdb
  17ef70ed_41ab_7cec_a5c5_0ffe17771d22["remark-shiki-twoslash"]
  6e951d9c_c380_852e_a8dc_24658d70674d --> 17ef70ed_41ab_7cec_a5c5_0ffe17771d22
  style 6e951d9c_c380_852e_a8dc_24658d70674d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import mdx from '@astrojs/mdx';
import { parseHTML } from 'linkedom';
import rehypePrettyCode from 'rehype-pretty-code';
import shikiTwoslash from 'remark-shiki-twoslash';
import { loadFixture } from '../../../astro/test/test-utils.js';

const FIXTURE_ROOT = new URL('./fixtures/mdx-syntax-hightlighting/', import.meta.url);

describe('MDX syntax highlighting', () => {
	describe('shiki', () => {
		it('works', async () => {
			const fixture = await loadFixture({
				root: FIXTURE_ROOT,
				markdown: {
					syntaxHighlight: 'shiki',
				},
				integrations: [mdx()],
			});
			await fixture.build();

			const html = await fixture.readFile('/index.html');
			const { document } = parseHTML(html);

			const shikiCodeBlock = document.querySelector('pre.astro-code');
			assert.notEqual(shikiCodeBlock, null);
			assert.equal(shikiCodeBlock.getAttribute('style').includes('background-color:#24292e'), true);
		});

		it('respects markdown.shikiConfig.theme', async () => {
			const fixture = await loadFixture({
				root: FIXTURE_ROOT,
				markdown: {
					syntaxHighlight: 'shiki',
					shikiConfig: {
						theme: 'dracula',
					},
				},
				integrations: [mdx()],
			});
			await fixture.build();

			const html = await fixture.readFile('/index.html');
			const { document } = parseHTML(html);

			const shikiCodeBlock = document.querySelector('pre.astro-code');
			assert.notEqual(shikiCodeBlock, null);
			assert.equal(shikiCodeBlock.getAttribute('style').includes('background-color:#282A36'), true);
		});
	});

	describe('prism', () => {
		it('works', async () => {
			const fixture = await loadFixture({
				root: FIXTURE_ROOT,
				markdown: {
					syntaxHighlight: 'prism',
				},
				integrations: [mdx()],
// ... (86 more lines)

Domain

Dependencies

Frequently Asked Questions

What does mdx-syntax-highlighting.test.js do?
mdx-syntax-highlighting.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does mdx-syntax-highlighting.test.js depend on?
mdx-syntax-highlighting.test.js imports 8 module(s): linkedom, loadFixture, mdx, node:test, rehype-pretty-code, remark-shiki-twoslash, strict, test-utils.js.
Where is mdx-syntax-highlighting.test.js in the architecture?
mdx-syntax-highlighting.test.js is located at packages/integrations/mdx/test/mdx-syntax-highlighting.test.js (domain: CoreAstro, directory: packages/integrations/mdx/test).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free