TechniqueMDX

Enhancing Markdown with remark and rehype plugins

2020-12-13Chris Tham

Why settle for generic Markdown? Additional functionality can be added to the markdown processing chain through remark and rehype plugins.

hero

Under the hood, MDX posts on this site are converted to HTML during build time using the next-mdx-remote processor which uses remark and rehype.

It’s possible to enhance the processing by adding plugins, and previously I had already enabled the remark-math and remark-mdx-math-enhanced plugins in my article called Rendering Math in Markdown.

I have now decided to explore what other remark plugins are available/

I have decided to install the following:

Table of Contents

remark-slug

remark plugin to add anchors headings using GitHub’s algorithm.

remark plugin to automatically add links to headings.

remark-toc

remark plugin to generate a table of contents.

rehype-code-titles

Rehype plugin for parsing code blocks and adding titles to code blocks.

rehype-highlight

Rehype plugin to highlight code blocks.

Subscribe to get updates to this site!

Like my articles? Enter your details and I will send you an email whenever the site has new content. I will not use your email for any other purpose.

Subscribe