Skip to content

Commit d6d84be

Browse files
authored
Remove more examples (vercel#89709)
Removing examples that we are not using, or maintaining anymore.
1 parent a0b5d9a commit d6d84be

30 files changed

+0
-838
lines changed

docs/01-app/02-guides/mdx.mdx

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -747,93 +747,6 @@ export default withMDX(nextConfig)
747747
>
748748
> remark and rehype plugins without serializable options cannot be used yet with [Turbopack](/docs/app/api-reference/turbopack), because JavaScript functions can't be passed to Rust.
749749
750-
## Remote MDX
751-
752-
If your MDX files or content lives _somewhere else_, you can fetch it dynamically on the server. This is useful for content stored in a CMS, database, or anywhere else. A community package for this use is [`next-mdx-remote-client`](https://github.com/ipikuka/next-mdx-remote-client?tab=readme-ov-file#the-part-associated-with-nextjs-app-router).
753-
754-
> **Good to know**: Please proceed with caution. MDX compiles to JavaScript and is executed on the server. You should only fetch MDX content from a trusted source, otherwise this can lead to remote code execution (RCE).
755-
756-
The following example uses `next-mdx-remote-client`:
757-
758-
<AppOnly>
759-
760-
```tsx filename="app/mdx-page-remote/page.tsx" switcher
761-
import { MDXRemote } from 'next-mdx-remote-client/rsc'
762-
763-
export default async function RemoteMdxPage() {
764-
// MDX text - can be from a database, CMS, fetch, anywhere...
765-
const res = await fetch('https://...')
766-
const markdown = await res.text()
767-
return <MDXRemote source={markdown} />
768-
}
769-
```
770-
771-
```jsx filename="app/mdx-page-remote/page.js" switcher
772-
import { MDXRemote } from 'next-mdx-remote-client/rsc'
773-
774-
export default async function RemoteMdxPage() {
775-
// MDX text - can be from a database, CMS, fetch, anywhere...
776-
const res = await fetch('https://...')
777-
const markdown = await res.text()
778-
return <MDXRemote source={markdown} />
779-
}
780-
```
781-
782-
</AppOnly>
783-
784-
<PagesOnly>
785-
786-
```tsx filename="pages/mdx-page-remote.tsx" switcher
787-
import {
788-
serialize,
789-
type SerializeResult,
790-
} from 'next-mdx-remote-client/serialize'
791-
import { MDXClient } from 'next-mdx-remote-client'
792-
793-
type Props = {
794-
mdxSource: SerializeResult
795-
}
796-
797-
export default function RemoteMdxPage({ mdxSource }: Props) {
798-
if ('error' in mdxSource) {
799-
// either render error UI or throw `mdxSource.error`
800-
}
801-
return <MDXClient {...mdxSource} />
802-
}
803-
804-
export async function getStaticProps() {
805-
// MDX text - can be from a database, CMS, fetch, anywhere...
806-
const res = await fetch('https:...')
807-
const mdxText = await res.text()
808-
const mdxSource = await serialize({ source: mdxText })
809-
return { props: { mdxSource } }
810-
}
811-
```
812-
813-
```jsx filename="pages/mdx-page-remote.js" switcher
814-
import { serialize } from 'next-mdx-remote-client/serialize'
815-
import { MDXClient } from 'next-mdx-remote-client'
816-
817-
export default function RemoteMdxPage({ mdxSource }) {
818-
if ('error' in mdxSource) {
819-
// either render error UI or throw `mdxSource.error`
820-
}
821-
return <MDXClient {...mdxSource} />
822-
}
823-
824-
export async function getStaticProps() {
825-
// MDX text - can be from a database, CMS, fetch, anywhere...
826-
const res = await fetch('https:...')
827-
const mdxText = await res.text()
828-
const mdxSource = await serialize({ source: mdxText })
829-
return { props: { mdxSource } }
830-
}
831-
```
832-
833-
</PagesOnly>
834-
835-
Navigating to the `/mdx-page-remote` route should display your rendered MDX.
836-
837750
## Deep Dive: How do you transform markdown into HTML?
838751

839752
React does not natively understand markdown. The markdown plaintext needs to first be transformed into HTML. This can be accomplished with `remark` and `rehype`.

examples/mdx-remote/.gitignore

Lines changed: 0 additions & 41 deletions
This file was deleted.

examples/mdx-remote/README.md

Lines changed: 0 additions & 60 deletions
This file was deleted.

examples/mdx-remote/app/[slug]/page.module.css

Lines changed: 0 additions & 3 deletions
This file was deleted.

examples/mdx-remote/app/[slug]/page.tsx

Lines changed: 0 additions & 45 deletions
This file was deleted.

examples/mdx-remote/app/globals.css

Lines changed: 0 additions & 59 deletions
This file was deleted.

examples/mdx-remote/app/layout.tsx

Lines changed: 0 additions & 32 deletions
This file was deleted.

examples/mdx-remote/app/page.tsx

Lines changed: 0 additions & 23 deletions
This file was deleted.

examples/mdx-remote/app/posts/example-post.mdx

Lines changed: 0 additions & 12 deletions
This file was deleted.

examples/mdx-remote/app/posts/hello-world.mdx

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)