Skip to content

Commit

Permalink
fixed build errors caused by mdx-server.ts and page.tsx under the exa…
Browse files Browse the repository at this point in the history
…mple/advanced-blog (#220)

Co-authored-by: Elchin Aslanli <[email protected]>
Co-authored-by: Andre Vitorio <[email protected]>
  • Loading branch information
3 people authored Apr 13, 2024
1 parent fc43386 commit 87dd328
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
1 change: 1 addition & 0 deletions examples/advanced-blog/src/app/(web)/[...slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ async function getData({ params }: Params) {
// if we have docs, we are on a collection archive
if (docs.length) {
return {
doc: undefined,
moreDocs: {
docs,
collection
Expand Down
43 changes: 20 additions & 23 deletions examples/advanced-blog/src/lib/mdx-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,26 @@ export default async function MDXServer(code: string) {
const result = await bundleMDX({
source: code,
mdxOptions(options) {
;(options.remarkPlugins = [
...(options.remarkPlugins ?? []),
remarkGfm // Adding remarkGfm here
]),
(options.rehypePlugins = [
...(options.rehypePlugins ?? []),
rehypeSlug,
[
rehypePrettyCode,
{
theme: 'dracula'
// The rest of the rehypePrettyCode config
}
],
[
rehypeAutolinkHeadings,
{
properties: {
className: ['hash-anchor']
}
}
]
])
options.remarkPlugins = options.remarkPlugins ?? []
options.remarkPlugins.push(remarkGfm as any)

options.rehypePlugins = options.rehypePlugins ?? []
options.rehypePlugins.push(rehypeSlug as any)
options.rehypePlugins.push([
rehypePrettyCode as any,
{
theme: 'dracula' // Add other rehypePrettyCode options if necessary
}
])
options.rehypePlugins.push([
rehypeAutolinkHeadings as any,
{
properties: {
className: ['hash-anchor']
}
}
])

return options
}
})
Expand Down

0 comments on commit 87dd328

Please sign in to comment.