Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mintlify/mdx",
"version": "0.0.48",
"version": "0.0.49",
"description": "Markdown parser from Mintlify",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down Expand Up @@ -57,18 +57,18 @@
"react-dom": "^18.3.1"
},
"dependencies": {
"@mdx-js/mdx": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@types/hast": "^3.0.4",
"@types/unist": "^3.0.3",
"@mdx-js/mdx": "^2.1.5",
"@mdx-js/react": "^2.1.3",
"@types/hast": "^3.0.0",
"@types/unist": "^2.0.6",
"hast-util-to-string": "^2.0.0",
"next-mdx-remote": "^5.0.0",
"next-mdx-remote": "^4.4.1",
"refractor": "^4.8.0",
"rehype-katex": "^7.0.1",
"remark-gfm": "^4.0.0",
"remark-math": "^6.0.0",
"remark-smartypants": "^3.0.2",
"unified": "^11.0.5",
"rehype-katex": "^6.0.3",
"remark-gfm": "^3.0.1",
"remark-math": "^5.1.1",
"remark-smartypants": "^2.0.0",
"unified": "^10.0.0",
"unist-util-visit": "^4.1.1"
}
}
47 changes: 15 additions & 32 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,6 @@
![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen?logo=github) [![Tweet](https://img.shields.io/twitter/url?url=https%3A%2F%2Fmintlify.com%2F)](https://twitter.com/intent/tweet?url=&text=Check%20out%20%40mintlify)

</p>

<p>
<a href="https://mintlify.com" target="_blank">
<img
src="https://mintlify.com/assets/og.png"
alt="Mintlify"
width="100%"
/>
</a>
</p>
</div>

# Mintlify's markdown parser
Expand Down Expand Up @@ -64,7 +54,7 @@ pnpm add @mintlify/mdx
```tsx
export const getStaticProps = (async () => {
const mdxSource = await getCompiledMdx({
source: "## Markdown H2",
source: '## Markdown H2',
});

return {
Expand All @@ -80,19 +70,16 @@ pnpm add @mintlify/mdx
2. Pass the `mdxSource` object as props inside the `MDXComponent`.

```tsx
export default function Page({
mdxSource,
}: InferGetStaticPropsType<typeof getStaticProps>) {
export default function Page({ mdxSource }: InferGetStaticPropsType<typeof getStaticProps>) {
return <MDXComponent {...mdxSource} />;
}
```

3. Import `@mintlify/mdx/dist/styles.css` inside your `_app.tsx` file. This file contains the styles for the code syntax highlighting.

```tsx
import "@mintlify/mdx/dist/styles.css";

import { AppProps } from "next/app";
import '@mintlify/mdx/dist/styles.css';
import { AppProps } from 'next/app';

export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
Expand All @@ -106,7 +93,7 @@ pnpm add @mintlify/mdx
1. Call the `getCompiledServerMdx` function inside your async React Server Component which will give you the `frontmatter` and `content`.

```tsx
import { getCompiledServerMdx } from "@mintlify/mdx";
import { getCompiledServerMdx } from '@mintlify/mdx';

export default async function Home() {
const { content, frontmatter } = await getCompiledServerMdx({
Expand All @@ -131,19 +118,15 @@ pnpm add @mintlify/mdx
2. Import `@mintlify/mdx/dist/styles.css` inside your `layout.tsx` file. This file contains the styles for the code syntax highlighting.

```tsx
import type { Metadata } from "next";
import "@mintlify/mdx/dist/styles.css";
import '@mintlify/mdx/dist/styles.css';
import type { Metadata } from 'next';

export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
title: 'Create Next App',
description: 'Generated by create next app',
};

export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>{children}</body>
Expand All @@ -164,10 +147,10 @@ Similar to [next-mdx-remote](https://github.com/hashicorp/next-mdx-remote), this
### getCompiledMdx

```tsx
import { getCompiledMdx } from "@mintlify/mdx";
import { getCompiledMdx } from '@mintlify/mdx';

const mdxSource = await getCompiledMdx({
source: "## Markdown H2",
source: '## Markdown H2',
mdxOptions: {
remarkPlugins: [
// Remark plugins
Expand All @@ -182,7 +165,7 @@ const mdxSource = await getCompiledMdx({
### MDXComponent

```tsx
import { MDXComponent } from "@mintlify/mdx";
import { MDXComponent } from '@mintlify/mdx';

<MDXComponent
components={
Expand All @@ -197,7 +180,7 @@ import { MDXComponent } from "@mintlify/mdx";
### getCompiledServerMdx

```tsx
import { getCompiledServerMdx } from "@mintlify/mdx";
import { getCompiledServerMdx } from '@mintlify/mdx';

const { content, frontmatter } = await getCompiledServerMdx({
source: `---
Expand All @@ -223,7 +206,7 @@ const { content, frontmatter } = await getCompiledServerMdx({
### MDXServerComponent

```tsx
import { MDXServerComponent } from "@mintlify/mdx";
import { MDXServerComponent } from '@mintlify/mdx';

<MDXServerComponent
source="## Markdown H2"
Expand Down
Loading