As @arunoda (Next.js founder) said Next.js does not support importing markdown files yet. But you can configure the Next.js webpack loaders to load raw-loader
modules and import markdown files and return them as strings.
Let get started!
Open the terminal, run the command below to install raw-loader
and react-markdown
modules (noted: use react-markdown to renders markdown as pure React components):
1 2 3 |
|
Create next.config.js
file with content below:
1 2 3 4 5 6 7 8 9 10 11 12 |
|
Create docs/about.md
file with content below:
1 2 3 |
|
Create pages/about.js
file with content below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
So far so good, That’s it!!! See ya!!! :)