Skip to content

Commit 52738ce

Browse files
authored
Merge pull request #370 from code-hike/new-themes
Refactor themes
2 parents c5acd6f + d5dcee5 commit 52738ce

Some content is hidden

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

60 files changed

+472
-5073
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ packages/mdx/components.d.ts
1515

1616
# Contentlayer
1717
.contentlayer
18+
19+
todo.md

examples/browser/index.html

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<title>Code Hike in the browser</title>
55
<link
66
rel="stylesheet"
7-
href="https://esm.sh/@code-hike/mdx@0.8.0--canary.308.cf940c7.0/dist/index.css"
7+
href="https://esm.sh/@code-hike/mdx@0.9.0/dist/index.css"
88
/>
99
</head>
1010
<body>
@@ -16,9 +16,8 @@
1616
import { evaluate } from "https://esm.sh/@mdx-js/mdx?bundle"
1717
import * as runtime from "https://esm.sh/react/jsx-runtime.js"
1818

19-
import theme from "https://esm.sh/[email protected]/themes/dracula.json" assert { type: "json" }
20-
import { remarkCodeHike } from "https://esm.sh/@code-hike/[email protected]/dist/index.browser.mjs"
21-
import { CH } from "https://esm.sh/@code-hike/[email protected]/components"
19+
import { remarkCodeHike } from "https://esm.sh/@code-hike/[email protected]/dist/index.browser.mjs"
20+
import { CH } from "https://esm.sh/@code-hike/[email protected]/components"
2221

2322
const mdx = `# Test
2423
@@ -37,7 +36,9 @@
3736

3837
const { default: Content } = await evaluate(mdx, {
3938
...runtime,
40-
remarkPlugins: [[remarkCodeHike, { autoImport: false, theme }]],
39+
remarkPlugins: [
40+
[remarkCodeHike, { autoImport: false, theme: "dracula" }],
41+
],
4142
})
4243

4344
const App = () => {

examples/bundle-test/next.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
const { remarkCodeHike } = require("@code-hike/mdx")
2-
const theme = require("shiki/themes/nord.json")
32

43
const withMDX = require("@next/mdx")({
54
extension: /\.mdx?$/,
65
options: {
7-
remarkPlugins: [[remarkCodeHike, { theme }]],
6+
remarkPlugins: [[remarkCodeHike, { theme: "nord" }]],
87
},
98
})
109

examples/contentlayer/contentlayer.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import { defineDocumentType, makeSource } from "contentlayer/source-files"
22
import { remarkCodeHike } from "@code-hike/mdx"
3-
import { createRequire } from "module"
4-
const require = createRequire(import.meta.url)
5-
const theme = require("shiki/themes/material-palenight.json")
63

74
const Post = defineDocumentType(() => ({
85
name: "Post",
@@ -27,5 +24,5 @@ export default makeSource({
2724
contentDirPath: "posts",
2825
documentTypes: [Post],
2926

30-
mdx: { remarkPlugins: [[remarkCodeHike, { theme }]] },
27+
mdx: { remarkPlugins: [[remarkCodeHike, { theme: "material-palenight" }]] },
3128
})

examples/docusaurus/docusaurus.config.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// @ts-check
22
// Note: type annotations allow type checking and IDEs autocompletion
33

4-
const theme = require("shiki/themes/material-palenight.json")
54
const { remarkCodeHike } = require("@code-hike/mdx")
65

76
/** @type {import('@docusaurus/types').Config} */
@@ -18,7 +17,9 @@ const config = {
1817
/** @type {import('@docusaurus/preset-classic').Options} */
1918
({
2019
docs: {
21-
beforeDefaultRemarkPlugins: [[remarkCodeHike, { theme }]],
20+
beforeDefaultRemarkPlugins: [
21+
[remarkCodeHike, { theme: "material-palenight" }],
22+
],
2223
sidebarPath: require.resolve("./sidebars.js"),
2324
},
2425
theme: {

examples/gatsby/gatsby-config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const { remarkCodeHike } = require("@code-hike/mdx")
2-
const theme = require("shiki/themes/material-palenight.json")
32

43
module.exports = {
54
siteMetadata: {
@@ -11,7 +10,7 @@ module.exports = {
1110
options: {
1211
extensions: [`.mdx`, `.md`],
1312
mdxOptions: {
14-
remarkPlugins: [[remarkCodeHike, { theme }]],
13+
remarkPlugins: [[remarkCodeHike, { theme: "material-palenight" }]],
1514
},
1615
},
1716
},

examples/mdx-bundler/src/posts.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import fs from "fs"
22
import path from "path"
33
import { remarkCodeHike } from "@code-hike/mdx"
4-
import theme from "shiki/themes/material-palenight.json"
54
import { bundleMDX } from "mdx-bundler"
65

76
export function getPostNames() {
@@ -42,7 +41,7 @@ export async function getPostSource(postName) {
4241
mdxOptions(options) {
4342
options.remarkPlugins = [
4443
...(options.remarkPlugins ?? []),
45-
[remarkCodeHike, { theme }],
44+
[remarkCodeHike, { theme: "material-palenight" }],
4645
]
4746
return options
4847
},

examples/next-mdx-remote/pages/posts/[slug].js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import path from "path"
66
import { postNames, POSTS_PATH } from "../../src/posts"
77
import { remarkCodeHike } from "@code-hike/mdx"
88
import { CH } from "@code-hike/mdx/components"
9-
import theme from "shiki/themes/material-palenight.json"
109

1110
export default function PostPage({ source }) {
1211
return (
@@ -28,7 +27,9 @@ export const getStaticProps = async ({ params }) => {
2827

2928
const mdxSource = await serialize(source, {
3029
mdxOptions: {
31-
remarkPlugins: [[remarkCodeHike, { autoImport: false, theme }]],
30+
remarkPlugins: [
31+
[remarkCodeHike, { autoImport: false, theme: "material-palenight" }],
32+
],
3233
useDynamicImport: true,
3334
},
3435
})

examples/nextjs/next.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
const { remarkCodeHike } = require("@code-hike/mdx")
2-
const theme = require("shiki/themes/material-palenight.json")
32

43
const withMDX = require("@next/mdx")({
54
extension: /\.mdx?$/,
65
options: {
7-
remarkPlugins: [[remarkCodeHike, { theme }]],
6+
remarkPlugins: [[remarkCodeHike, { theme: "material-palenight" }]],
87
},
98
})
109

examples/nextra/next.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
const { remarkCodeHike } = require("@code-hike/mdx")
2-
const theme = require("shiki/themes/material-palenight.json")
32

43
const withNextra = require("nextra")({
54
theme: "nextra-theme-docs",
65
themeConfig: "./theme.config.mjs",
76
mdxOptions: {
8-
remarkPlugins: [[remarkCodeHike, { theme }]],
7+
remarkPlugins: [[remarkCodeHike, { theme: "material-palenight" }]],
98
},
109
})
1110

examples/nextra/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"nextra": "2.4.2",
1414
"nextra-theme-docs": "2.4.2",
1515
"react": "^18.1.0",
16-
"react-dom": "^18.1.0",
17-
"shiki": "^0.10.1"
16+
"react-dom": "^18.1.0"
1817
}
1918
}

examples/remix/remix.config.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
const { remarkCodeHike } = require("@code-hike/mdx")
2-
const theme = require("shiki/themes/dracula.json")
3-
42
/**
53
* @type {import('@remix-run/dev').AppConfig}
64
*/
@@ -12,6 +10,6 @@ module.exports = {
1210
// publicPath: "/build/",
1311
// devServerPort: 8002
1412
mdx: {
15-
remarkPlugins: [[remarkCodeHike, { theme }]],
13+
remarkPlugins: [[remarkCodeHike, { theme: "dracula" }]],
1614
},
1715
}

0 commit comments

Comments
 (0)