Gathering detailed insights and metrics for @snappify/next-markdown
Gathering detailed insights and metrics for @snappify/next-markdown
Gathering detailed insights and metrics for @snappify/next-markdown
Gathering detailed insights and metrics for @snappify/next-markdown
Markdown Pages for Next.js with 0 effort, dynamic routes and your layout design
npm install @snappify/next-markdown
Typescript
Module System
Node Version
NPM Version
59.3
Supply Chain
91.5
Quality
73.9
Maintenance
100
Vulnerability
98.9
License
TypeScript (99.77%)
JavaScript (0.16%)
Swift (0.07%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
1,327
Last Day
1
Last Week
3
Last Month
16
Last Year
534
121 Stars
159 Commits
5 Forks
3 Watchers
1 Branches
3 Contributors
Updated on Feb 19, 2025
Latest Version
1.8.1
Package Id
@snappify/next-markdown@1.8.1
Unpacked Size
67.05 kB
Size
17.73 kB
File Count
6
NPM Version
8.19.3
Node Version
16.19.0
Published on
May 31, 2023
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
-40%
3
Compared to previous week
Last Month
300%
16
Compared to previous month
Last Year
-32.7%
534
Compared to previous year
10
Markdown Pages for Next.js
Dynamic Routes • Blog Aware • Design Your Layout
Made for people
/about
, /terms
, /blog
, /docs
or /whatever/other/route
from markdown files with 0 effortUsed by
In your nextjs project, run
1npm install next-markdown
Add the following [...nextmd].jsx
file in the pages/
folder
1import NextMarkdown from "next-markdown"; 2 3const nextmd = NextMarkdown({ pathToContent: "./pages-markdown" }); 4 5export const getStaticPaths = nextmd.getStaticPaths; 6export const getStaticProps = nextmd.getStaticProps; 7 8export default function MarkdownPage({ frontMatter, html, subPaths }) { 9 return <div dangerouslySetInnerHTML={{ __html: html }} /> 👈 design your own layout 🧑🎨 10}
At the root of your project create the folder pages-markdown/
, add the following hello.md
file
# Hello World
This is **awesome**
That's it. Open http://localhost:3000/hello
page and see the magic.
Enjoy.
next-markdown
generates routes based on the path of your markdown files.
Just like nextjs does with pages/
.
For example, the following project structure will result into creating the following pages:
pages/
├ index.jsx ......... ➡️ /
├ caveat.jsx ......... ➡️ /caveat
├ [...nextmd].jsx
pages-markdown/
├ about.md ......... ➡️ /about
├ caveat.md ......... ➡️ ❌ because `pages/caveat.jsx` is already defined cf. https://nextjs.org/docs/routing/dynamic-routes#caveats
├ hello/
├ index.md ......... ➡️ /hello
├ world.md ......... ➡️ /hello/world
├ jurassic/
├ park.md ......... ➡️ /hello/jurassic/park
├ blog/
├ index.md ......... ➡️ /blog
├ hello.md ......... ➡️ /blog/hello
├ world.md ......... ➡️ /blog/world
├ docs/
├ index.md ......... ➡️ /docs
├ get-started.md ... ➡️ /docs/get-started
├ features.md ...... ➡️ /docs/features
├ contribute.md .... ➡️ /docs/contribute
See the example.
next-markdown
is blog-aware:
_hello.md
will redirect to 404)next-markdown
lets you build a documentation:
For each page you'll receive the Table of Contents based on headings in your markdown.
Use next-markdown
to browse and parse your markdown files so you can build your personal blog in seconds.
There is nothing to setup on your side, MDX support comes for free.
You can mix .md
and .mdx
files.
next-markdown
comes with some default remark and rehype plugins to ensure its basic functionality.
In some cases you might want to specify additional plugins to enrich your page with extra features.
You can pass custom remark and rehype plugins via the next-markdown
initializer config:
1import NextMarkdown from "next-markdown"; 2 3const nextmd = NextMarkdown({ 4 ..., 5 remarkPlugins: [], 6 rehypePlugins: [], 7});
For many good reasons you may want to host your content in another GIT repo.
More examples here ↗️.
Feel free to browse them to see next-markdown
in action.
Thanks for your interest in next-markdown! You are very welcome to contribute. If you are proposing a new feature, please open an issue to make sure it is inline with the project goals.
1git clone https://github.com/your-name/next-markdown.git 2cd next-markdown
1npm install 2npm run dev
examples/
folder, install dependencies and run dev1cd examples/blog # or dynamic-routes, or remote-content 2npm install 3npm run dev
src/
, save: http://localhost:3000 gets updated automatically (aka hot-reloading)src/__tests__/
. Run tests with npm test
command.Before you make your pull request, make sure to run:
npm test
to make sure nothing is brokennpm run format
to make sure the code looks consistentnpm run lint
to make sure there is no problem in the codeNo vulnerabilities found.
No security vulnerabilities found.