Skip to content

Commit 25fb030

Browse files
Brendonovichkodiakhq[bot]jer3m01
authored
Use SolidBase (#1092)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> Co-authored-by: jer3m01 <jer3m01@jer3m01.com>
1 parent 2ad2333 commit 25fb030

File tree

70 files changed

+3472
-2782
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3472
-2782
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ netlify
4747
.vinxi
4848

4949
public/sitemap.xml
50-
public/i18n-status
50+
public/i18n-status

WRITING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ We ask that you use them sparingly.
6666
3. Once you have the Aside component imported, simply follow the below example for how to add one to your document.
6767

6868
```
69-
<Callout>
69+
:::info
7070
content here
71-
</Callout>
71+
:::
7272
```
7373

7474
### Code examples

app.config.ts

Lines changed: 70 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,7 @@
11
import { 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;
165
import tree from "./.solid/tree";
176
import entries from "./.solid/flat-entries";
187
import 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,73 @@ 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: [/\{\getPath}/, /.*?emojiSvg\(.*/],
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: [/\{\getPath}/, /.*?emojiSvg\(.*/],
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+
editPath: "https://github.com/solidjs/solid-docs/edit/main/:path",
67+
markdown: {
68+
expressiveCode: {
69+
themes: ["min-light", "material-theme-ocean"],
70+
themeCssSelector: (theme) => `[data-theme="${theme.type}"]`,
71+
frames: false,
7272
},
73-
jsx: true,
74-
jsxImportSource: "solid-js",
75-
providerImportSource: "solid-mdx",
76-
rehypePlugins: [
77-
[
78-
rehypeRaw,
79-
{
80-
passThrough: nodeTypes,
81-
},
82-
],
83-
[rehypeSlug],
84-
[
85-
rehypeAutoLinkHeadings,
86-
{
87-
behavior: "wrap",
88-
properties: {
89-
className: "heading",
90-
},
91-
},
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}"]`,
103-
},
104-
],
105-
],
106-
}),
107-
{ enforce: "pre" },
108-
],
109-
}),
110-
});
73+
toc: {
74+
minDepth: 2,
75+
},
76+
},
77+
}
78+
)
79+
);
80+
81+
import { readFile } from "node:fs/promises";
82+
import { codeToHtml } from "shiki";
83+
84+
function heroCodeSnippet() {
85+
const virtualModuleId = "solid:hero-code-snippet";
86+
const resolveVirtualModuleId = "\0" + virtualModuleId;
87+
88+
return {
89+
name: virtualModuleId,
90+
resolveId(id: string) {
91+
if (id === virtualModuleId) {
92+
return resolveVirtualModuleId;
93+
}
94+
},
95+
async load(id: string) {
96+
if (id === resolveVirtualModuleId) {
97+
const snippet = await readFile(
98+
"./src/ui/layout/hero-code-snippet.code",
99+
"utf-8"
100+
);
101+
102+
const highlightedCode = await codeToHtml(snippet.trim(), {
103+
lang: "tsx",
104+
theme: "material-theme-ocean",
105+
});
106+
107+
return `export const highlightedCode = \`${highlightedCode}\``;
108+
}
109+
},
110+
};
111+
}

env.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ declare module "solid:collection" {
2020
const component: any;
2121
export default component;
2222
}
23+
24+
declare module "solid:hero-code-snippet" {
25+
export const highlightedCode: string;
26+
}

package.json

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,49 +18,44 @@
1818
"check:types": "tsc --noEmit"
1919
},
2020
"dependencies": {
21-
"@kobalte/core": "^0.13.6",
21+
"@kobalte/core": "^0.13.9",
22+
"@kobalte/solidbase": "^0.0.16",
2223
"@lunariajs/core": "^0.0.31",
2324
"@oramacloud/client": "^1.3.15",
25+
"@solid-primitives/event-listener": "^2.3.3",
2426
"@solid-primitives/marker": "^0.1.0",
27+
"@solid-primitives/media": "^2.2.9",
2528
"@solidjs/meta": "^0.29.4",
26-
"@solidjs/router": "^0.15.1",
27-
"@solidjs/start": "^1.0.10",
29+
"@solidjs/router": "^0.15.3",
30+
"@solidjs/start": "^1.1.1",
2831
"@vinxi/plugin-mdx": "^3.7.2",
2932
"dotenv": "^16.4.5",
3033
"glob": "^10.4.5",
3134
"gray-matter": "^4.0.3",
3235
"postcss": "^8.4.47",
33-
"rehype-autolink-headings": "^7.1.0",
34-
"rehype-parse": "^9.0.0",
35-
"rehype-slug": "^6.0.0",
36-
"remark-parse": "^11.0.0",
3736
"shiki": "^1.17.6",
3837
"sitemap": "^7.1.2",
3938
"solid-heroicons": "^3.2.4",
40-
"solid-js": "^1.9",
39+
"solid-js": "^1.9.5",
4140
"solid-list": "^0.3.0",
4241
"solid-mdx": "^0.0.7",
43-
"vinxi": "^0.5.1",
42+
"vinxi": "^0.5.3",
4443
"zod": "^3.23.8"
4544
},
4645
"devDependencies": {
4746
"@kobalte/tailwindcss": "^0.9.0",
48-
"@mdx-js/mdx": "^2.3.0",
4947
"@orama/crawly": "^0.0.4",
5048
"@tailwindcss/typography": "^0.5.15",
51-
"@types/node": "^20.16.5",
49+
"@types/node": "^22.9.0",
5250
"@typescript-eslint/eslint-plugin": "^8.7.0",
5351
"@typescript-eslint/parser": "^8.7.0",
5452
"autoprefixer": "^10.4.20",
5553
"eslint": "^8.57.1",
5654
"eslint-plugin-solid": "^0.13.2",
5755
"prettier": "3.2.5",
58-
"rehype-raw": "^7.0.0",
59-
"remark-expressive-code": "^0.33.5",
60-
"remark-frontmatter": "^5.0.0",
61-
"remark-gfm": "^3.0.0",
6256
"tailwindcss": "^3.4.11",
63-
"typescript": "^5.6.2"
57+
"typescript": "^5.6.2",
58+
"vite": "^6.1.1"
6459
},
6560
"engines": {
6661
"node": ">=18",

0 commit comments

Comments
 (0)