Skip to content

Commit

Permalink
Merge branch 'next14-dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
huangtinghao committed Jun 5, 2024
2 parents f13c5b2 + 7c05402 commit 0091757
Show file tree
Hide file tree
Showing 4 changed files with 332 additions and 3 deletions.
51 changes: 48 additions & 3 deletions contentlayer.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,44 @@
import { defineDocumentType, makeSource } from "contentlayer/source-files"
import {defineDocumentType, defineNestedType, makeSource} from "contentlayer/source-files"
import {codeImport} from "remark-code-import"
import remarkGfm from "remark-gfm"
import rehypeSlug from "rehype-slug"
import remarkMath from "remark-math"
import rehypeKatex from "rehype-katex"
import rehypePrettyCode from "rehype-pretty-code"

const LinksProperties = defineNestedType(() => ({
name: "LinksProperties",
fields: {
post: {
type: "string",
},
api: {
type: "string",
},
},
}))

export const Post = defineDocumentType(() => ({
name: "Post",
filePathPattern: `**/*.mdx`,
contentType: 'mdx',
fields: {
title: { type: "string", required: true },
date: { type: "date", required: true },
title: {
type: "string",
required: true
},
date: {
type: "date",
required: true
},
description: {
type: "string",
required: false
},
links: {
type: "nested",
of: LinksProperties
}
},
computedFields: {
url: {
Expand All @@ -19,4 +51,17 @@ export const Post = defineDocumentType(() => ({
export default makeSource({
contentDirPath: "posts",
documentTypes: [Post],
mdx: {
remarkPlugins: [remarkGfm, codeImport, remarkMath],
rehypePlugins: [
rehypeSlug,
rehypeKatex,
[
rehypePrettyCode,
{
theme: "material-theme-palenight",
},
],
],
}
})
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
"next-themes": "^0.3.0",
"react": "^18",
"react-dom": "^18",
"rehype-autolink-headings": "^7.1.0",
"rehype-katex": "^7.0.0",
"rehype-pretty-code": "^0.13.2",
"rehype-slug": "^6.0.0",
"remark-code-import": "^1.2.0",
"remark-gfm": "^4.0.0",
"remark-math": "^6.0.0",
"rimraf": "^5.0.7",
"tailwind-merge": "^2.3.0",
Expand Down
Loading

0 comments on commit 0091757

Please sign in to comment.