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

syntax-highlighting.test.js — astro Source File

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

File javascript CoreAstro RoutingSystem 8 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  06a4f90b_1e9f_7421_e791_b3a07e2643ec["syntax-highlighting.test.js"]
  7c366155_b62e_62d4_5b28_32c2f0b9be56["../dist/extensions/prism.js"]
  06a4f90b_1e9f_7421_e791_b3a07e2643ec --> 7c366155_b62e_62d4_5b28_32c2f0b9be56
  9d4473af_06bf_6c7d_3b13_4ad45d3cf8fb["../dist/extensions/shiki.js"]
  06a4f90b_1e9f_7421_e791_b3a07e2643ec --> 9d4473af_06bf_6c7d_3b13_4ad45d3cf8fb
  dca05bf6_3d63_d869_e1f2_9d4535ea6227["../dist/runtime.js"]
  06a4f90b_1e9f_7421_e791_b3a07e2643ec --> dca05bf6_3d63_d869_e1f2_9d4535ea6227
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  06a4f90b_1e9f_7421_e791_b3a07e2643ec --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  06a4f90b_1e9f_7421_e791_b3a07e2643ec --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  9e63cbe8_497c_4ffa_fe72_98f051e32a00["markdoc"]
  06a4f90b_1e9f_7421_e791_b3a07e2643ec --> 9e63cbe8_497c_4ffa_fe72_98f051e32a00
  21c9aedb_261f_6744_350a_486c989130ae["index.js"]
  06a4f90b_1e9f_7421_e791_b3a07e2643ec --> 21c9aedb_261f_6744_350a_486c989130ae
  cb315bcc_59d8_fa19_79aa_5da7cd3730c5["linkedom"]
  06a4f90b_1e9f_7421_e791_b3a07e2643ec --> cb315bcc_59d8_fa19_79aa_5da7cd3730c5
  style 06a4f90b_1e9f_7421_e791_b3a07e2643ec fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import Markdoc from '@markdoc/markdoc';
import { isHTMLString } from 'astro/runtime/server/index.js';
import { parseHTML } from 'linkedom';
import prism from '../dist/extensions/prism.js';
import shiki from '../dist/extensions/shiki.js';
import { setupConfig } from '../dist/runtime.js';

const entry = `
\`\`\`ts
const highlighting = true;
\`\`\`

\`\`\`css
.highlighting {
	color: red;
}
\`\`\`
`;

describe('Markdoc - syntax highlighting', () => {
	describe('shiki', () => {
		it('transforms with defaults', async () => {
			const ast = Markdoc.parse(entry);
			const content = await Markdoc.transform(ast, await getConfigExtendingShiki());

			assert.equal(content.children.length, 2);
			for (const codeBlock of content.children) {
				assert.equal(isHTMLString(codeBlock), true);

				const pre = parsePreTag(codeBlock);
				assert.equal(pre.classList.contains('astro-code'), true);
				assert.equal(pre.classList.contains('github-dark'), true);
			}
		});
		it('transforms with `theme` property', async () => {
			const ast = Markdoc.parse(entry);
			const content = await Markdoc.transform(
				ast,
				await getConfigExtendingShiki({
					theme: 'dracula',
				}),
			);
			assert.equal(content.children.length, 2);
			for (const codeBlock of content.children) {
				assert.equal(isHTMLString(codeBlock), true);

				const pre = parsePreTag(codeBlock);
				assert.equal(pre.classList.contains('astro-code'), true);
				assert.equal(pre.classList.contains('dracula'), true);
			}
		});
		it('transforms with `wrap` property', async () => {
			const ast = Markdoc.parse(entry);
			const content = await Markdoc.transform(
				ast,
				await getConfigExtendingShiki({
					wrap: true,
				}),
// ... (77 more lines)

Domain

Subdomains

Dependencies

  • ../dist/extensions/prism.js
  • ../dist/extensions/shiki.js
  • ../dist/runtime.js
  • index.js
  • linkedom
  • markdoc
  • node:test
  • strict

Frequently Asked Questions

What does syntax-highlighting.test.js do?
syntax-highlighting.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in syntax-highlighting.test.js?
syntax-highlighting.test.js defines 2 function(s): getConfigExtendingShiki, parsePreTag.
What does syntax-highlighting.test.js depend on?
syntax-highlighting.test.js imports 8 module(s): ../dist/extensions/prism.js, ../dist/extensions/shiki.js, ../dist/runtime.js, index.js, linkedom, markdoc, node:test, strict.
Where is syntax-highlighting.test.js in the architecture?
syntax-highlighting.test.js is located at packages/integrations/markdoc/test/syntax-highlighting.test.js (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/markdoc/test).

Analyze Your Own Codebase

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

Try Supermodel Free