Skip to content

Builds on Next.js's starter blog using TypeScript by adding support for KaTeX in markdown files.

License

Notifications You must be signed in to change notification settings

abbyoung/nextjs-starter-ts

Repository files navigation

NextJS Starter Blog

About

This starter builds on Next.js's TypeScript starter blog with added KaTeX support in markdown files.

It uses the UnifiedJS ecosystem to parse and process markdown files located in posts/. An example post is included: posts/markdown-math.md.

Use $ (inline) or $$ (blocks) to wrap KaTeX syntax in your files. This marks them for processing by remark-math.

All text processing takes place in lib/posts.ts, utilizing a handful of Remark plugins. Remark-math parses $ and $$ into math nodes. Remark-html-katex transforms those nodes with KaTeX. The necessary css for rendering KaTeX is imported in _app.tsx.

Getting Started

yarn install
yarn dev

This should get you up and running. Open in your browser at localhost:3000.

To view KaTeX in action, click on the blog post titled KaTeX and Markdown. If everything works properly, you should see the following rendered:

KaTeX example

Troubleshooting

Apple M1 Chip

(As of 7/1/2021)

I've had problems running this NextJS starter with certain versions of node on M1 MacBooks. Tested and working versions include v15.3.0 and 16.3.0.

Hopefully the bug will be fixed by the time anyone finds this! If not, I recommend installing nodenv and trying different versions.

About

Builds on Next.js's starter blog using TypeScript by adding support for KaTeX in markdown files.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published