hamdan.id

Using Shiki with rehype-pretty-code

2025-05-18

Using Shiki with rehype-pretty-code

One of the best ways to render code in your blog is by using rehype-pretty-code, which wraps Shiki and gives you access to VS Code themes, line highlighting, word highlights, and more.

Let's say you want to render a TypeScript function:

export const greet = (name: string) => {
  return `Hello, ${name}`;
};

Join the discussion