Skip to content

Commit 515d799

Browse files
authored
Merge pull request #443 from code-hike/next
Update website
2 parents 4928cbb + 6eda3ed commit 515d799

30 files changed

Lines changed: 6044 additions & 242 deletions

.changeset/config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
3-
"changelog": "@changesets/cli/changelog",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{ "repo": "code-hike/codehike" }
6+
],
47
"commit": false,
58
"fixed": [],
69
"linked": [],

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- next
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- run: corepack enable
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: 20
20+
cache: "pnpm"
21+
22+
- name: Install dependencies
23+
run: pnpm install
24+
25+
- name: Build
26+
run: pnpm build
27+
28+
- run: pnpm canary

apps/web/content/blog/from-remark-to-rsc.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ authors: [pomber]
66
draft: true
77
---
88

9+
Content usually needs some kind of transformation before being rendered.
10+
911
A remark plugin is a function that transforms pieces of a markdown file.

apps/web/content/blog/v1-migration.mdx

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -110,30 +110,33 @@ Instead of "use-v1", you can use any string. Just make sure it's easy to find an
110110

111111
Here's the equivalent features between v0 and v1, they aren't exactly the same, but they are similar:
112112

113-
| | v0 | v1 |
114-
| -------------------- | ---------------- | ------------------- |
115-
| Package name | `@code-hike/mdx` | `codehike` |
116-
| Line numbers | [Config][1] | [Example][21] |
117-
| Copy button | [Config][2] | [Example][22] |
118-
| Themes | [Config][3] | [Config][23] |
119-
| Skip languages | [Config][4] | [Config][24] |
120-
| Static components | [Config][5] | [Media queries][25] |
121-
| Auto import | [Config][6] | Not needed |
122-
| Auto link | [Config][7] | [Example][26] |
123-
| Codeblock filename | [Directive][8] | [Example][27] |
124-
| `focus` | [Annotation][9] | [Example][28] |
125-
| `mark` | [Annotation][10] | [Example][29] |
126-
| `withClass` | [Annotation][11] | [Example][30] |
127-
| `link` | [Annotation][12] | [Example][31] |
128-
| `from` | [Annotation][13] | [Syntax][32] |
129-
| `<CH.Code>` Tabs | [Component][14] | [Example][33] |
130-
| `<CH.Code>` Panels | [Component][15] | - |
131-
| Inline code | [Syntax][16] | [Syntax][35] |
132-
| Code mentions | [Syntax][17] | [Example][36] |
133-
| `<CH.Scrollycoding>` | [Component][18] | [Example][37] |
134-
| `<CH.Spotlight>` | [Component][19] | [Example][38] |
135-
| `<CH.Slideshow>` | [Component][20] | [Example][39] |
136-
113+
| | v0 | v1 |
114+
| -------------------- | -------------------------- | ----------------------- |
115+
| Docs | [v0.codehike.org/docs][50] | [codehike.org/docs][51] |
116+
| Package name | `@code-hike/mdx` | `codehike` |
117+
| Line numbers | [Config][1] | [Example][21] |
118+
| Copy button | [Config][2] | [Example][22] |
119+
| Themes | [Config][3] | [Config][23] |
120+
| Skip languages | [Config][4] | [Config][24] |
121+
| Static components | [Config][5] | [Media queries][25] |
122+
| Auto import | [Config][6] | Not needed |
123+
| Auto link | [Config][7] | [Example][26] |
124+
| Codeblock filename | [Directive][8] | [Example][27] |
125+
| `focus` | [Annotation][9] | [Example][28] |
126+
| `mark` | [Annotation][10] | [Example][29] |
127+
| `withClass` | [Annotation][11] | [Example][30] |
128+
| `link` | [Annotation][12] | [Example][31] |
129+
| `from` | [Annotation][13] | [Syntax][32] |
130+
| `<CH.Code>` Tabs | [Component][14] | [Example][33] |
131+
| `<CH.Code>` Panels | [Component][15] | - |
132+
| Inline code | [Syntax][16] | [Syntax][35] |
133+
| Code mentions | [Syntax][17] | [Example][36] |
134+
| `<CH.Scrollycoding>` | [Component][18] | [Example][37] |
135+
| `<CH.Spotlight>` | [Component][19] | [Example][38] |
136+
| `<CH.Slideshow>` | [Component][20] | [Example][39] |
137+
138+
[50]: https://v0.codehike.org/docs
139+
[51]: https://codehike.org/docs
137140
[1]: https://v0.codehike.org/docs/configuration#line-numbers
138141
[2]: https://v0.codehike.org/docs/configuration#copy-button
139142
[3]: https://v0.codehike.org/docs/themes

apps/web/content/docs/code/focus.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import React, { useLayoutEffect, useRef } from "react"
3333

3434
export const focus: AnnotationHandler = {
3535
name: "focus",
36+
onlyIfAnnotated: true,
3637
PreWithRef: (props) => {
3738
const ref = getPreRef(props)
3839
useScrollToFocus(ref)

apps/web/next.config.mjs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
import createNextDocsMDX from "next-docs-mdx/config"
22
import { remarkCodeHike, recmaCodeHike } from "codehike/mdx"
3+
// import fs from "node:fs"
4+
// import { jsx, toJs } from "estree-util-to-js"
5+
// function recmaPlugin() {
6+
// return (tree) => {
7+
// const result = toJs(tree, { handlers: jsx })
8+
// // console.log("```js")
9+
// // console.log(result.value)
10+
// // console.log("```")
11+
// fs.writeFileSync("recma.js", result.value)
12+
// }
13+
// }
314

415
/** @type {import('codehike/mdx').CodeHikeConfig} */
516
const chConfig = {
@@ -17,7 +28,7 @@ const withMDX = createNextDocsMDX({
1728
mdxOptions: {
1829
remarkPlugins: [[remarkCodeHike, chConfig]],
1930
recmaPlugins: [[recmaCodeHike, chConfig]],
20-
jsx: true,
31+
// jsx: true,
2132
},
2233
})
2334

apps/web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"codehike": "workspace:*",
2525
"diff": "^5.1.0",
2626
"dotenv": "^16.4.1",
27+
"estree-util-to-js": "^2.0.0",
2728
"lucide-react": "^0.303.0",
2829
"next": "14.1.0",
2930
"next-docs-mdx": "7.1.2",

apps/web/ui/nav.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,18 @@ export function NavBar({ version }: { version: string }) {
6060
function VersionNav({ version }: { version: string }) {
6161
return (
6262
<DropdownMenu>
63-
<DropdownMenuTrigger className="text-sm bg-secondary text-primary rounded-lg px-2">
63+
<DropdownMenuTrigger className="text-sm bg-secondary text-primary rounded-lg px-2 tabular-nums">
6464
{version}
6565
</DropdownMenuTrigger>
66-
<DropdownMenuContent>
67-
<DropdownMenuItem className="p-0">
68-
<span className="w-full px-2 py-1">{version}</span>
66+
<DropdownMenuContent className="min-w-[5rem]">
67+
<DropdownMenuItem className="p-0 text-center">
68+
<span className="w-full px-2 py-1 tabular-nums">{version}</span>
6969
</DropdownMenuItem>
70-
<DropdownMenuItem className="p-0">
71-
<a href="https://v0.codehike.org/docs" className="w-full px-2 py-1">
70+
<DropdownMenuItem className="p-0 text-center">
71+
<a
72+
href="https://v0.codehike.org/docs"
73+
className="w-full px-2 py-1 tabular-nums"
74+
>
7275
0.9.0
7376
</a>
7477
</DropdownMenuItem>

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@
88
"format": "prettier --write \"**/*.{ts,tsx,md,mdx}\"",
99
"changeset": "changeset",
1010
"version-packages": "changeset version",
11-
"release": "changeset publish"
11+
"release": "changeset publish",
12+
"canary": "pkg-pr-new publish --no-template --compact './packages/codehike'"
1213
},
1314
"devDependencies": {
1415
"@changesets/cli": "2.27.1",
16+
"@changesets/changelog-github": "0.5.0",
1517
"prettier": "^3.1.1",
16-
"turbo": "^1.11.2"
18+
"turbo": "^1.11.2",
19+
"pkg-pr-new": "0.0.20"
1720
},
1821
"packageManager": "pnpm@9.7.1",
1922
"repository": "code-hike/codehike",

0 commit comments

Comments
 (0)