Home / File/ prism.ts — astro Source File

prism.ts — astro Source File

Architecture documentation for prism.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.

File typescript CoreAstro RoutingSystem 3 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  98b47c20_2c30_515b_e879_3710eeab2cf2["prism.ts"]
  e0eab863_6cf9_cc6e_219c_2c937d09a9cd["./config.js"]
  98b47c20_2c30_515b_e879_3710eeab2cf2 --> e0eab863_6cf9_cc6e_219c_2c937d09a9cd
  2832a16b_7543_e831_197a_94bd6022c901["highlighter"]
  98b47c20_2c30_515b_e879_3710eeab2cf2 --> 2832a16b_7543_e831_197a_94bd6022c901
  21c9aedb_261f_6744_350a_486c989130ae["index.js"]
  98b47c20_2c30_515b_e879_3710eeab2cf2 --> 21c9aedb_261f_6744_350a_486c989130ae
  style 98b47c20_2c30_515b_e879_3710eeab2cf2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { runHighlighterWithAstro } from '@astrojs/prism/dist/highlighter';
import { unescapeHTML } from 'astro/runtime/server/index.js';
import { type AstroMarkdocConfig, Markdoc } from '../config.js';

export default function prism(): AstroMarkdocConfig {
	return {
		nodes: {
			fence: {
				attributes: Markdoc.nodes.fence.attributes!,
				transform({ attributes: { language, content } }) {
					const { html, classLanguage } = runHighlighterWithAstro(language, content);

					// Use `unescapeHTML` to return `HTMLString` for Astro renderer to inline as HTML
					return unescapeHTML(
						`<pre class="${classLanguage}"><code class="${classLanguage}">${html}</code></pre>`,
					) as any;
				},
			},
		},
	};
}

Domain

Subdomains

Functions

Dependencies

  • ./config.js
  • highlighter
  • index.js

Frequently Asked Questions

What does prism.ts do?
prism.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in prism.ts?
prism.ts defines 1 function(s): prism.
What does prism.ts depend on?
prism.ts imports 3 module(s): ./config.js, highlighter, index.js.
Where is prism.ts in the architecture?
prism.ts is located at packages/integrations/markdoc/src/extensions/prism.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/markdoc/src/extensions).

Analyze Your Own Codebase

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

Try Supermodel Free