An open API service indexing awesome lists of open source software.

https://github.com/debbl/remark-headerify


https://github.com/debbl/remark-headerify

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

# remark headerify

## Install with Nextjs

```bash
pnpm i remark-headerify -D
```

## Usage

- only use for nextjs with mdx

- parse frontmatter config for Header component and Main component

> info.md

```md
---
title: Info
---

# Info
```

## parse
```md
---
title: Info
---

# Info

```

> mdx-components.tsx

```tsx
import type { MDXComponents } from "mdx/types";
import Header from "./components/Header";

export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
Header: (props: { title: string }) => {
const { title = "" } = props;

return ;
},
Main: ({ children }: { children: React.ReactNode }) => {
return {children};
},

...components,
};
}
```