Home / File/ highlight.test.js — astro Source File

highlight.test.js — astro Source File

Architecture documentation for highlight.test.js, a javascript file in the astro codebase. 3 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  ec70d174_23bc_e1f7_65e5_16a8893d6762["highlight.test.js"]
  8350d254_ac08_0a3a_4696_d1a19f979b3a["../dist/index.js"]
  ec70d174_23bc_e1f7_65e5_16a8893d6762 --> 8350d254_ac08_0a3a_4696_d1a19f979b3a
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  ec70d174_23bc_e1f7_65e5_16a8893d6762 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  ec70d174_23bc_e1f7_65e5_16a8893d6762 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style ec70d174_23bc_e1f7_65e5_16a8893d6762 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { createMarkdownProcessor } from '../dist/index.js';

describe('highlight', () => {
	it('highlights using shiki by default', async () => {
		const processor = await createMarkdownProcessor();
		const { code } = await processor.render('```js\nconsole.log("Hello, world!");\n```');
		assert.match(code, /background-color:/);
	});

	it('does not highlight math code blocks by default', async () => {
		const processor = await createMarkdownProcessor();
		const { code } = await processor.render('```math\n\\frac{1}{2}\n```');

		assert.ok(!code.includes('background-color:'));
	});

	it('highlights using prism', async () => {
		const processor = await createMarkdownProcessor({
			syntaxHighlight: {
				type: 'prism',
			},
		});
		const { code } = await processor.render('```js\nconsole.log("Hello, world!");\n```');
		assert.ok(code.includes('token'));
	});

	it('supports excludeLangs', async () => {
		const processor = await createMarkdownProcessor({
			syntaxHighlight: {
				type: 'shiki',
				excludeLangs: ['mermaid'],
			},
		});
		const { code } = await processor.render('```mermaid\ngraph TD\nA --> B\n```');

		assert.ok(!code.includes('background-color:'));
	});

	it('supports excludeLangs with prism', async () => {
		const processor = await createMarkdownProcessor({
			syntaxHighlight: {
				type: 'prism',
				excludeLangs: ['mermaid'],
			},
		});
		const { code } = await processor.render('```mermaid\ngraph TD\nA --> B\n```');

		assert.ok(!code.includes('token'));
	});
});

Domain

Dependencies

  • ../dist/index.js
  • node:test
  • strict

Frequently Asked Questions

What does highlight.test.js do?
highlight.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does highlight.test.js depend on?
highlight.test.js imports 3 module(s): ../dist/index.js, node:test, strict.
Where is highlight.test.js in the architecture?
highlight.test.js is located at packages/markdown/remark/test/highlight.test.js (domain: CoreAstro, directory: packages/markdown/remark/test).

Analyze Your Own Codebase

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

Try Supermodel Free