Published on

Rendering Reference

Authors
  • avatar
    Name
    Jason Sooter

This post exists to exercise every part of the markdown pipeline in one place, so rendering regressions are obvious after a dependency upgrade. If something here looks wrong, the plugin responsible is named in the heading above it.

Code blocks — rehype-prism-plus

A plain block with no language, falling back to the configured defaultLanguage:

git rebase origin/main

TypeScript, the most common case on this site:

type Post = {
  slug: string
  title: string
  tags: string[]
  draft?: boolean
}

export function publishedPosts(posts: Post[]): Post[] {
  return posts.filter((post) => post.draft !== true)
}

Code titles — remark-code-titles

The title bar is a separate element (.remark-code-title) styled to sit flush on top of the block. If the two ever drift apart, the radius or margin rules are the cause:

scripts/rss.mjs
const publishPosts = allBlogs.filter((post) => post.draft !== true)

Line highlighting

Lines 2 and 4-5 should be marked:

const config = {
  darkMode: 'class',
  content: ['./app/**/*.tsx'],
  theme: {
    extend: {},
  },
}

Line numbers

def slugify(value: str) -> str:
    return value.lower().replace(" ", "-")


print(slugify("Rendering Reference"))

Other languages

rm -rf .contentlayer .next && npm run build
.remark-code-title {
  @apply rounded-t-sm bg-gray-700 px-5 py-3 font-mono text-sm font-bold;
}
{
  "engines": { "node": "24.x" }
}

Inline code such as npm dedupe unified should sit on the surrounding line without changing its height.

Math — remark-math + rehype-katex

Inline math: the golden ratio φ=1+52\varphi = \frac{1 + \sqrt{5}}{2} sits mid-sentence.

Display math gets its own block and scrolls horizontally if it overflows:

i=1ni=n(n+1)2\sum_{i=1}^{n} i = \frac{n(n+1)}{2}

Tables — remark-gfm

PackageBeforeAfter
tailwindcss3.3.34.3.3
contentlayer0.3.40.5.8
node20.x24.x

Lists and task lists

  1. Ordered item
  2. Another, with a nested list
    • nested bullet
    • another one
  • Completed task
  • Incomplete task

A blockquote, which should carry the prose border and spacing.

Spanning two paragraphs.

Bold, italic, struck through, and a link that should pick up the primary colour on hover.


Footnotes

Footnotes render at the bottom with a back-reference arrow1, and the .footnotes rule adds the divider above them2.

Citations — rehype-citation

Citations resolve against data/references-data.bib (Nash, 1950), and multiple keys render together (Nash, 1951; Xie, 2016). The bibliography below is generated by the plugin, and each entry uses the .csl-entry spacing rule.

References

Nash, J. (1950). Equilibrium points in n-person games. Proceedings of the National Academy of Sciences, 36(1), 48–49.
Nash, J. (1951). Non-cooperative games. Annals of Mathematics, 286–295.
Xie, Y. (2016). Bookdown: authoring books and technical documents with R markdown. CRC Press.

Footnotes

  1. The back-reference is .data-footnote-backref, styled to drop its underline.

  2. A second footnote, to confirm ordering and spacing.