Keyboard shortcuts for rich text editor (e.g., cmd+option+2 for H2)

4 replies
Last updated: Dec 22, 2021
Is there any way to use keyboard shortcuts for the rich text editor? I can’t for example be able to add an h2 using cmd + option + 2, as I can in Google Docs and in Contentful
AI Update

Great news! Sanity recently added markdown-style keyboard shortcuts to the Portable Text Editor. According to the changelog from January 2025, the editor now ships with markdown keyboard shortcuts for headings, block quotes, and lists.

However, these shortcuts work differently from the traditional CMD+Option+2 style you're used to in Google Docs or Contentful. Instead, they use markdown-style shortcuts:

  • Type ## followed by a space to create an H2 heading
  • Type ### followed by a space for H3, and so on
  • Type > followed by a space for block quotes
  • Type - or * followed by a space for bullet lists
  • Type 1. followed by a space for numbered lists

This markdown approach is becoming increasingly common in modern editors and can be quite efficient once you get used to it. The shortcuts trigger automatically when you type the pattern and hit space.

If you need the traditional keyboard shortcuts (like CMD+Option+2), that's not currently a built-in feature, but you could potentially build a custom plugin to add those shortcuts. The Portable Text Editor is highly configurable, and you can extend it with custom behaviors.

The markdown shortcuts should be available in recent versions of Sanity Studio, so make sure you're running an up-to-date version to access this feature. If you're not seeing them work, try updating your Studio dependencies.

Show original thread
4 replies
We don't currently have any keyboard commands for the Editor, unfortunately.
Alright, no worries. Is this something you are planning on adding or something that I can implement myself somehow?
It is something on our minds but no concrete plans for adding it now. It is a bit of a nontrivial task.
Do share if you manage to implement it, though! It would be exciting to see.

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?