Extend Astro with custom integrations. Integrations are your one-stop-shop for adding framework support (like Solid.js), new features (like sitemaps), and new libraries (like Partytown).
Read our Integrations Guide for help getting started with Astro Integrations.
A utility function that helps you define an Expressive Code configuration object. It is meant
to be used inside the optional config file ec.config.mjs located in the root directory
of your Astro project, and its return value to be exported as the default export.
Expressive Code will automatically detect this file and use the exported configuration object
to override its own default settings.
Using this function is recommended, but not required. It just passes through the given object,
but it also provides type information for your editor's auto-completion and type checking.
A utility function that helps you define an Expressive Code configuration object. It is meant
to be used inside the optional config file ec.config.mjs located in the root directory
of your Astro project, and its return value to be exported as the default export.
Expressive Code will automatically detect this file and use the exported configuration object
to override its own default settings.
Using this function is recommended, but not required. It just passes through the given object,
but it also provides type information for your editor's auto-completion and type checking.
Extend Astro with custom integrations. Integrations are your one-stop-shop for adding framework support (like Solid.js), new features (like sitemaps), and new libraries (like Partytown).
Read our Integrations Guide for help getting started with Astro Integrations.
A utility function that helps you define an Expressive Code configuration object. It is meant
to be used inside the optional config file ec.config.mjs located in the root directory
of your Starlight project, and its return value to be exported as the default export.
Expressive Code will automatically detect this file and use the exported configuration object
to override its own default settings.
Using this function is recommended, but not required. It just passes through the given object,
but it also provides type information for your editor's auto-completion and type checking.
A utility function that helps you define an Expressive Code configuration object. It is meant
to be used inside the optional config file ec.config.mjs located in the root directory
of your Starlight project, and its return value to be exported as the default export.
Expressive Code will automatically detect this file and use the exported configuration object
to override its own default settings.
Using this function is recommended, but not required. It just passes through the given object,
but it also provides type information for your editor's auto-completion and type checking.
@returns ― A plugin object with the specified configuration.
ecTwoSlash({
PluginTwoslashOptions.instanceConfigs?: {
twoslash?: {
explicitTrigger?: boolean | RegExp;
languages?: ReadonlyArray<string>;
};
eslint?: {
explicitTrigger?: boolean | RegExp;
languages?: ReadonlyArray<string>;
};
} |undefined
Allows for configuring the included twoslasher instances and their triggers.
instanceConfigs: {
twoslash?: {
explicitTrigger?: boolean | RegExp;
languages?: ReadonlyArray<string>;
} |undefined
Standard Twoslash instance configuration.
twoslash: {
explicitTrigger?: boolean | RegExp |undefined
If true, requires twoslash to be present in the code block meta for
this transformer to be applied.
If a RegExp, requires the RegExp to match a directive in the code
block meta for this transformer to be applied.
If false, this transformer will be applied to all code blocks that match
the specified languages.
It is recommended to keep this as true to avoid unnecessary processing.
@default ― true
explicitTrigger: true,
languages?: readonly string[] |undefined
The languages to apply this transformer to.
@default ― ["ts", "tsx", "vue"]
languages: ["ts", "tsx", "vue"],
},
eslint?: {
explicitTrigger?: boolean | RegExp;
languages?: ReadonlyArray<string>;
} |undefined
ESLint Twoslash instance configuration.
Unlike the standard Twoslash instance, the ESLint Twoslash instance uses eslint as its meta trigger for code blocks, and it is designed to work with JavaScript and TypeScript code blocks that contain ESLint errors. When a code block is annotated with eslint, the ESLint Twoslash instance will parse the code and display any ESLint errors as annotations in the code block.
eslint: {
explicitTrigger?: boolean | RegExp |undefined
If true, requires eslint to be present in the code block meta for
this transformer to be applied.
If a RegExp, requires the RegExp to match a directive in the code
block meta for this transformer to be applied.
If false, this transformer will be applied to all code blocks that match
the specified languages.
It is recommended to keep this as true to avoid unnecessary processing.