Skip to content

Commit f36c2e1

Browse files
committed
feat: install xmdx and setup config
1 parent 273ebfb commit f36c2e1

5 files changed

Lines changed: 1025 additions & 206 deletions

File tree

astro.config.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import starlight from '@astrojs/starlight';
2-
import { pluginCollapsibleSections } from '@expressive-code/plugin-collapsible-sections';
2+
import xmdx from 'astro-xmdx';
3+
import { starlightPreset } from 'astro-xmdx/presets';
34
import { defineConfig, sharpImageService } from 'astro/config';
45
import rehypeSlug from 'rehype-slug';
56
import remarkSmartypants from 'remark-smartypants';
@@ -28,9 +29,6 @@ export default defineConfig({
2829
]),
2930
starlight({
3031
title: 'Docs',
31-
expressiveCode: {
32-
plugins: [pluginCollapsibleSections()],
33-
},
3432
components: {
3533
EditLink: './src/components/starlight/EditLink.astro',
3634
Hero: './src/components/starlight/Hero.astro',
@@ -72,6 +70,10 @@ export default defineConfig({
7270
plugins: [starlightPluginSmokeTest(), starlightPluginLlmsTxt()],
7371
}),
7472
sitemap(),
73+
xmdx({
74+
presets: [starlightPreset({ expressiveCode: false })],
75+
expressiveCode: { enabled: true, importSource: '@astrojs/starlight/components' },
76+
}),
7577
],
7678
trailingSlash: 'always',
7779
scopedStyleStrategy: 'where',
@@ -95,4 +97,9 @@ export default defineConfig({
9597
domains: ['avatars.githubusercontent.com'],
9698
service: sharpImageService(),
9799
},
100+
vite: {
101+
ssr: {
102+
noExternal: ['xmdx'],
103+
},
104+
},
98105
});

config/plugins/llms-txt.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import starlightLlmsTxt from 'starlight-llms-txt';
33
/** Starlight plugin that sets up `starlight-llms-txt` with configuration for the Astro docs. */
44
export const starlightPluginLlmsTxt = () =>
55
starlightLlmsTxt({
6+
// Use raw Markdown content directly instead of rendering entries to avoid
7+
// compatibility issues with the xmdx compiler.
8+
rawContent: true,
69
// Basic information about the docs and Astro to display in the main `llms.txt` entry file.
710
projectName: 'Astro',
811
description: 'Astro is an all-in-one web framework for building websites. ',

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,16 @@
5959
"dependencies": {
6060
"@astrojs/check": "^0.9.6",
6161
"@astrojs/sitemap": "^3.6.0",
62-
"@astrojs/starlight": "^0.37.1",
63-
"@expressive-code/plugin-collapsible-sections": "^0.41.3",
62+
"@astrojs/starlight": "https://pkg.pr.new/@astrojs/starlight@5173976",
6463
"@lunariajs/core": "https://pkg.pr.new/lunariajs/lunaria/@lunariajs/core@722c34c",
64+
"astro-xmdx": "0.0.10-next.8",
6565
"canvas-confetti": "^1.6.0",
6666
"jsdoc-api": "^9.3.5",
6767
"rehype-slug": "^6.0.0",
6868
"remark-smartypants": "^3.0.2",
6969
"sharp": "^0.34.3",
70-
"starlight-llms-txt": "^0.6.0"
70+
"starlight-llms-txt": "^0.6.0",
71+
"xmdx": "0.0.9-next.2"
7172
},
7273
"packageManager": "pnpm@10.27.0",
7374
"pnpm": {

0 commit comments

Comments
 (0)