11import { defineConfig } from "@solidjs/start/config" ;
2- import remarkFrontmatter from "remark-frontmatter" ;
3- import rehypeRaw from "rehype-raw" ;
4- import { nodeTypes } from "@mdx-js/mdx" ;
5- import remarkGfm from "remark-gfm" ;
6- import remarkExpressiveCode , {
7- ExpressiveCodeTheme ,
8- } from "remark-expressive-code" ;
9- import rehypeSlug from "rehype-slug" ;
10- import rehypeAutoLinkHeadings from "rehype-autolink-headings" ;
112
12- // @ts -expect-error missing types
13- import pkg from "@vinxi/plugin-mdx" ;
3+ import { createWithSolidBase , defineTheme } from "@kobalte/solidbase/config" ;
144
15- const { default : vinxiMdx } = pkg ;
165import tree from "./.solid/tree" ;
176import entries from "./.solid/flat-entries" ;
187import solidstartEntries from "./.solid/solid-start-flat-entries" ;
@@ -27,7 +16,7 @@ function docsData() {
2716 const resolveVirtualModuleId = "\0" + virtualModuleId ;
2817
2918 return {
30- name : "solid:collection" ,
19+ name : virtualModuleId ,
3120 resolveId ( id : string ) {
3221 if ( id === virtualModuleId ) {
3322 return resolveVirtualModuleId ;
@@ -50,61 +39,130 @@ function docsData() {
5039 } ;
5140}
5241
53- export default defineConfig ( {
54- middleware : "src/middleware/index.ts" ,
55- server : {
56- preset : "netlify" ,
57- prerender : {
58- crawlLinks : true ,
59- autoSubfolderIndex : false ,
60- failOnError : true ,
61- // eslint-disable-next-line no-useless-escape
62- ignore : [ / \{ \g e t P a t h } / , / .* ?e m o j i S v g \( .* / ] ,
42+ const theme = defineTheme ( {
43+ componentsPath : import . meta. resolve ( "./src/solidbase-theme" ) ,
44+ } ) ;
45+ export default defineConfig (
46+ createWithSolidBase ( theme ) (
47+ {
48+ ssr : true ,
49+ middleware : "src/middleware/index.ts" ,
50+ server : {
51+ preset : "netlify" ,
52+ prerender : {
53+ crawlLinks : true ,
54+ autoSubfolderIndex : false ,
55+ failOnError : true ,
56+ // eslint-disable-next-line no-useless-escape
57+ ignore : [ / \{ \g e t P a t h } / , / .* ?e m o j i S v g \( .* / ] ,
58+ } ,
59+ } ,
60+ vite : {
61+ plugins : [ docsData ( ) , heroCodeSnippet ( ) ] ,
62+ } ,
6363 } ,
64- } ,
65- extensions : [ "mdx" , "md" , "tsx" ] ,
66- vite : ( ) => ( {
67- plugins : [
68- docsData ( ) ,
69- vinxiMdx . withImports ( { } ) ( {
70- define : {
71- "import.meta.env" : "'import.meta.env'" ,
64+ {
65+ title : "Solid Docs" ,
66+ description :
67+ "Documentation for SolidJS, the signals-powered UI framework" ,
68+ editPath : "https://github.com/solidjs/solid-docs/edit/main/:path" ,
69+ markdown : {
70+ expressiveCode : {
71+ themes : [ "min-light" , "material-theme-ocean" ] ,
72+ themeCssSelector : ( theme ) => `[data-theme="${ theme . type } "]` ,
73+ frames : false ,
74+ styleOverrides : {
75+ twoSlash : {
76+ cursorColor : "var(--twoslash-cursor)" ,
77+ } ,
78+ } ,
79+ twoSlash : false ,
80+ } ,
81+ toc : {
82+ minDepth : 2 ,
7283 } ,
73- jsx : true ,
74- jsxImportSource : "solid-js" ,
75- providerImportSource : "solid-mdx" ,
76- rehypePlugins : [
77- [
78- rehypeRaw ,
79- {
80- passThrough : nodeTypes ,
84+ packageManagers : {
85+ presets : {
86+ npm : {
87+ install : "npm i :content" ,
88+ "install-dev" : "npm i :content -D" ,
89+ "install-global" : "npm i :content -g" ,
90+ "install-local" : "npm i" ,
91+ run : "npm run :content" ,
92+ exec : "npx :content" ,
93+ create : "npm init :content" ,
8194 } ,
82- ] ,
83- [ rehypeSlug ] ,
84- [
85- rehypeAutoLinkHeadings ,
86- {
87- behavior : "wrap" ,
88- properties : {
89- className : "heading" ,
90- } ,
95+ pnpm : {
96+ install : "pnpm i :content" ,
97+ "install-dev" : "pnpm i :content -D" ,
98+ "install-global" : "pnpm i :content -g" ,
99+ "install-local" : "pnpm i" ,
100+ run : "pnpm :content" ,
101+ exec : "pnpx :content" ,
102+ create : "pnpm create :content" ,
91103 } ,
92- ] ,
93- ] ,
94- remarkPlugins : [
95- remarkFrontmatter ,
96- remarkGfm ,
97- [
98- remarkExpressiveCode ,
99- {
100- themes : [ "min-light" , "material-theme-ocean" ] ,
101- themeCSSSelector : ( theme : ExpressiveCodeTheme ) =>
102- `[data-theme="${ theme . name } "]` ,
104+ yarn : {
105+ install : "yarn add :content" ,
106+ "install-dev" : "yarn add :content -D" ,
107+ "install-global" : "yarn add :content -g" ,
108+ "install-local" : "yarn i" ,
109+ run : "yarn :content" ,
110+ exec : "yarn dlx :content" ,
111+ create : "yarn create :content" ,
103112 } ,
104- ] ,
105- ] ,
106- } ) ,
107- { enforce : "pre" } ,
108- ] ,
109- } ) ,
110- } ) ;
113+ bun : {
114+ install : "bun i :content" ,
115+ "install-dev" : "bun i :content -d" ,
116+ "install-global" : "bun i :content -g" ,
117+ "install-local" : "bun i" ,
118+ run : "bun run :content" ,
119+ exec : "bunx :content" ,
120+ create : "bun create :content" ,
121+ } ,
122+ deno : {
123+ install : "deno add npm::content" ,
124+ "install-dev" : "deno add npm::content -D" ,
125+ "install-global" : "deno add npm::content -g" ,
126+ "install-local" : "deno i" ,
127+ run : "deno run :content" ,
128+ exec : "dpx :content" ,
129+ create : "deno run -A npm:create-:content" ,
130+ } ,
131+ } ,
132+ } ,
133+ } ,
134+ }
135+ )
136+ ) ;
137+
138+ import { readFile } from "node:fs/promises" ;
139+ import { codeToHtml } from "shiki" ;
140+
141+ function heroCodeSnippet ( ) {
142+ const virtualModuleId = "solid:hero-code-snippet" ;
143+ const resolveVirtualModuleId = "\0" + virtualModuleId ;
144+
145+ return {
146+ name : virtualModuleId ,
147+ resolveId ( id : string ) {
148+ if ( id === virtualModuleId ) {
149+ return resolveVirtualModuleId ;
150+ }
151+ } ,
152+ async load ( id : string ) {
153+ if ( id === resolveVirtualModuleId ) {
154+ const snippet = await readFile (
155+ "./src/ui/layout/hero-code-snippet.code" ,
156+ "utf-8"
157+ ) ;
158+
159+ const highlightedCode = await codeToHtml ( snippet . trim ( ) , {
160+ lang : "tsx" ,
161+ theme : "material-theme-ocean" ,
162+ } ) ;
163+
164+ return `export const highlightedCode = \`${ highlightedCode } \`` ;
165+ }
166+ } ,
167+ } ;
168+ }
0 commit comments