Skip to content

Commit d118a4b

Browse files
authored
Merge branch 'main' into minimize-preview-panel
2 parents 7c411f3 + d586225 commit d118a4b

File tree

3 files changed

+25
-5
lines changed

3 files changed

+25
-5
lines changed

e2e/test/topbar.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ test('user can change theme', async ({ page }) => {
2121
await expect(heading).toHaveCSS('color', hexToRGB(theme.colors.gray[200]));
2222
});
2323

24-
test('user can download project as zip', async ({ page }) => {
24+
// TODO: Enable once https://github.com/stackblitz/tutorialkit/issues/447 is fixed
25+
test.skip('user can download project as zip', async ({ page }) => {
2526
await page.goto('/', { waitUntil: 'networkidle' });
2627

2728
const downloadPromise = page.waitForEvent('download');

packages/astro/src/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { fileURLToPath } from 'node:url';
22
import type { AstroConfig, AstroIntegration } from 'astro';
3+
import type { ExpressiveCodePlugin } from 'astro-expressive-code';
34
import { extraIntegrations } from './integrations.js';
45
import { updateMarkdownConfig } from './remark/index.js';
56
import { tutorialkitCore } from './vite-plugins/core.js';
@@ -59,13 +60,21 @@ export interface Options {
5960
*/
6061
scope: string;
6162
};
63+
64+
/**
65+
* Expressive code plugins.
66+
*
67+
* @default []
68+
*/
69+
expressiveCodePlugins?: ExpressiveCodePlugin[];
6270
}
6371

6472
export default function createPlugin({
6573
defaultRoutes = true,
6674
components,
6775
isolation,
6876
enterprise,
77+
expressiveCodePlugins = [],
6978
}: Options = {}): AstroIntegration {
7079
const webcontainerFiles = new WebContainerFiles();
7180

@@ -137,7 +146,11 @@ export default function createPlugin({
137146

138147
// inject the additional integrations right after ours
139148
const selfIndex = config.integrations.findIndex((integration) => integration.name === '@tutorialkit/astro');
140-
config.integrations.splice(selfIndex + 1, 0, ...extraIntegrations({ root: fileURLToPath(config.root) }));
149+
config.integrations.splice(
150+
selfIndex + 1,
151+
0,
152+
...extraIntegrations({ root: fileURLToPath(config.root), expressiveCodePlugins }),
153+
);
141154
},
142155
'astro:config:done'({ config }) {
143156
_config = config;

packages/astro/src/integrations.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,20 @@ import react from '@astrojs/react';
44
import { pluginCollapsibleSections } from '@expressive-code/plugin-collapsible-sections';
55
import { pluginLineNumbers } from '@expressive-code/plugin-line-numbers';
66
import { getInlineContentForPackage } from '@tutorialkit/theme';
7-
import expressiveCode from 'astro-expressive-code';
7+
import expressiveCode, { type ExpressiveCodePlugin } from 'astro-expressive-code';
88
import UnoCSS from 'unocss/astro';
99

10-
export function extraIntegrations({ root }: { root: string }) {
10+
export function extraIntegrations({
11+
root,
12+
expressiveCodePlugins = [],
13+
}: {
14+
root: string;
15+
expressiveCodePlugins?: ExpressiveCodePlugin[];
16+
}) {
1117
return [
1218
react(),
1319
expressiveCode({
14-
plugins: [pluginCollapsibleSections(), pluginLineNumbers()],
20+
plugins: [pluginCollapsibleSections(), pluginLineNumbers(), ...expressiveCodePlugins],
1521
themes: ['dark-plus', 'light-plus'],
1622
customizeTheme: (theme) => {
1723
const isDark = theme.type === 'dark';

0 commit comments

Comments
 (0)