shiki.ts — astro Source File
Architecture documentation for shiki.ts, a typescript file in the astro codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 4ceccdea_9be9_42de_3363_d624eaae10f0["shiki.ts"] e0eab863_6cf9_cc6e_219c_2c937d09a9cd["./config.js"] 4ceccdea_9be9_42de_3363_d624eaae10f0 --> e0eab863_6cf9_cc6e_219c_2c937d09a9cd 82f345a2_2234_43f1_c3c4_eea191acdca8["markdown-remark"] 4ceccdea_9be9_42de_3363_d624eaae10f0 --> 82f345a2_2234_43f1_c3c4_eea191acdca8 9e63cbe8_497c_4ffa_fe72_98f051e32a00["markdoc"] 4ceccdea_9be9_42de_3363_d624eaae10f0 --> 9e63cbe8_497c_4ffa_fe72_98f051e32a00 f16d8c76_2866_6150_bd14_0347b59abfe9["astro"] 4ceccdea_9be9_42de_3363_d624eaae10f0 --> f16d8c76_2866_6150_bd14_0347b59abfe9 21c9aedb_261f_6744_350a_486c989130ae["index.js"] 4ceccdea_9be9_42de_3363_d624eaae10f0 --> 21c9aedb_261f_6744_350a_486c989130ae style 4ceccdea_9be9_42de_3363_d624eaae10f0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { createShikiHighlighter } from '@astrojs/markdown-remark';
import Markdoc from '@markdoc/markdoc';
import type { ShikiConfig } from 'astro';
import { unescapeHTML } from 'astro/runtime/server/index.js';
import type { AstroMarkdocConfig } from '../config.js';
export default async function shiki(config?: ShikiConfig): Promise<AstroMarkdocConfig> {
const highlighter = await createShikiHighlighter({
langs: config?.langs,
theme: config?.theme,
themes: config?.themes,
});
return {
nodes: {
fence: {
attributes: Markdoc.nodes.fence.attributes!,
async transform({ attributes }) {
// NOTE: The `meta` from fence code, e.g. ```js {1,3-4}, isn't quite supported by Markdoc.
// Only the `js` part is parsed as `attributes.language` and the rest is ignored. This means
// some Shiki transformers may not work correctly as it relies on the `meta`.
const lang = typeof attributes.language === 'string' ? attributes.language : 'plaintext';
const html = await highlighter.codeToHtml(attributes.content, lang, {
wrap: config?.wrap,
defaultColor: config?.defaultColor,
transformers: config?.transformers,
});
// Use `unescapeHTML` to return `HTMLString` for Astro renderer to inline as HTML
return unescapeHTML(html) as any;
},
},
},
};
}
Domain
Subdomains
Functions
Dependencies
- ./config.js
- astro
- index.js
- markdoc
- markdown-remark
Source
Frequently Asked Questions
What does shiki.ts do?
shiki.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 shiki.ts?
shiki.ts defines 1 function(s): shiki.
What does shiki.ts depend on?
shiki.ts imports 5 module(s): ./config.js, astro, index.js, markdoc, markdown-remark.
Where is shiki.ts in the architecture?
shiki.ts is located at packages/integrations/markdoc/src/extensions/shiki.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