mdx-math.test.js — astro Source File
Architecture documentation for mdx-math.test.js, a javascript file in the astro codebase. 9 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 4c7681d0_f7ab_8492_2025_8d2de12bd32d["mdx-math.test.js"] 0a624eac_945e_c9e8_c9de_3feb9de2dd15["test-utils.js"] 4c7681d0_f7ab_8492_2025_8d2de12bd32d --> 0a624eac_945e_c9e8_c9de_3feb9de2dd15 dd4f09ce_3fd7_8295_f616_8876cda4555c["loadFixture"] 4c7681d0_f7ab_8492_2025_8d2de12bd32d --> dd4f09ce_3fd7_8295_f616_8876cda4555c e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"] 4c7681d0_f7ab_8492_2025_8d2de12bd32d --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607 6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"] 4c7681d0_f7ab_8492_2025_8d2de12bd32d --> 6b0635f9_51ea_77aa_767b_7857878e98a6 b05fd4c1_a3ee_3301_adcd_43b49bae78f1["mdx"] 4c7681d0_f7ab_8492_2025_8d2de12bd32d --> b05fd4c1_a3ee_3301_adcd_43b49bae78f1 cb315bcc_59d8_fa19_79aa_5da7cd3730c5["linkedom"] 4c7681d0_f7ab_8492_2025_8d2de12bd32d --> cb315bcc_59d8_fa19_79aa_5da7cd3730c5 81519e8b_6a61_3c32_de55_53938a26cda5["rehype-mathjax"] 4c7681d0_f7ab_8492_2025_8d2de12bd32d --> 81519e8b_6a61_3c32_de55_53938a26cda5 bf3ad7bf_7906_31a2_2ccf_16d376530adf["chtml"] 4c7681d0_f7ab_8492_2025_8d2de12bd32d --> bf3ad7bf_7906_31a2_2ccf_16d376530adf dbfa898d_9c27_3747_f4ad_2584a20001c3["remark-math"] 4c7681d0_f7ab_8492_2025_8d2de12bd32d --> dbfa898d_9c27_3747_f4ad_2584a20001c3 style 4c7681d0_f7ab_8492_2025_8d2de12bd32d 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 rehypeMathjaxSvg from 'rehype-mathjax';
import rehypeMathjaxChtml from 'rehype-mathjax/chtml';
import remarkMath from 'remark-math';
import { loadFixture } from '../../../astro/test/test-utils.js';
const FIXTURE_ROOT = new URL('./fixtures/mdx-math/', import.meta.url);
describe('MDX math', () => {
describe('mathjax', () => {
it('works with svg', async () => {
const fixture = await loadFixture({
root: FIXTURE_ROOT,
markdown: {
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeMathjaxSvg],
},
integrations: [mdx()],
});
await fixture.build();
const html = await fixture.readFile('/mathjax/index.html');
const { document } = parseHTML(html);
const mjxContainer = document.querySelector('mjx-container[jax="SVG"]');
assert.notEqual(mjxContainer, null);
const mjxStyle = document.querySelectorAll('style')[0].innerHTML;
assert.equal(
mjxStyle.includes('mjx-container[jax="SVG"]'),
true,
'style should not be html-escaped',
);
});
it('works with chtml', async () => {
const fixture = await loadFixture({
root: FIXTURE_ROOT,
markdown: {
remarkPlugins: [remarkMath],
rehypePlugins: [
[
rehypeMathjaxChtml,
{
chtml: {
fontURL: 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/output/chtml/fonts/woff-v2',
},
},
],
],
},
integrations: [mdx()],
});
await fixture.build();
const html = await fixture.readFile('/mathjax/index.html');
const { document } = parseHTML(html);
const mjxContainer = document.querySelector('mjx-container[jax="CHTML"]');
assert.notEqual(mjxContainer, null);
const mjxStyle = document.querySelectorAll('style')[0].innerHTML;
assert.equal(
mjxStyle.includes('mjx-container[jax="CHTML"]'),
true,
'style should not be html-escaped',
);
});
});
});
Domain
Dependencies
- chtml
- linkedom
- loadFixture
- mdx
- node:test
- rehype-mathjax
- remark-math
- strict
- test-utils.js
Source
Frequently Asked Questions
What does mdx-math.test.js do?
mdx-math.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does mdx-math.test.js depend on?
mdx-math.test.js imports 9 module(s): chtml, linkedom, loadFixture, mdx, node:test, rehype-mathjax, remark-math, strict, and 1 more.
Where is mdx-math.test.js in the architecture?
mdx-math.test.js is located at packages/integrations/mdx/test/mdx-math.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