Skip to content




Using markdown shortcuts with the Portable Text Editor

Using markdown shortcuts with the Portable Text Editor

It's finally here, we've been excited to type a little # before our titles and get that magnificent pop in heading size. Let's get started

Jono Alford
Sne Tripathi
Jono and Sne

Click me for the TL;DR (too long; didn't read)

2024's hot request: shortcuts in Sanity's Text Editor. Finally dropped! Update with 'npm i sanity@latest'. Cheat sheet: markdown shortcuts for headings, lists, and more. Don't forget keyboard shortcuts for bold/italic. Full-screen mode for focus. Should've read this sooner, huh?

Throughout 2024, one of the top editorial requests has been shortcuts within the Sanity Portable Text Editor.

It's been a bit of a pain point and the one QOL productivity feature we think was missing.

Now, guess what dropped just before the end of the year (opens in new tab).

So you know what that means: if you're not already using the auto-updating Sanity Studio (opens in new tab), make sure you run:

sh
npm i sanity@latest

Now we've got that up and running, let's move on to the cheat sheet. Keep reading to find out a pitfall we fell into when testing it for the first time.

Cheat Sheet

Here's a list of all the markdown shortcuts we've discovered so far. Everything highlighted on the left should be typed into the Sanity Portable Text field followed by a space to change the formatting.

Headings

# - Heading 1

## - Heading 2

### - Heading 3

#### - Heading 4

##### - Heading 5

###### - Heading 6

Blockquote

> - Blockquote

Lists

1. - Ordered list

- or * - Unordered list

Pitfall to be aware of

If you're like us, you probably restricted <h1> when you set up your Portable Text Editor for SEO reasons.

Naturally, the first thing you are going to test from the cheat sheet above is # and then see if a Heading 1 appears...

This won't work if you're not including Heading 1's in your configuration and you will get the same result as we did below.

We all make mistakes - here's an example of us trying to get a <h1> to work

Make sure whatever markdown shortcut you're trying to use, actually exists inside of your Portable Text Editor.

Services
$ Sanity CMS development
Portable Text customization, editor shortcuts, and Sanity studio setup for content teams.
>Learn more

Keyboard shortcuts exist as well

You may be aware of a couple of Markdown shortcuts we missed from above, specifically bold and italic. The good news is that they're in there, but with keyboard shortcuts instead.

For example, highlight some text and hit:

⌘ + B - Make text bold

⌘ + I - Make text italic

No spam, only good stuff

Subscribe, for more hot takes

Only god knows why anybody would purposefully subscribe themselves to a newsletter that moans about development. These poor souls did though
Profile 1
Profile 2
Profile 3
Profile 4
Profile 5

Bonus tip: full-screen Portable Text Editor

Things can easily become distracting if too many tabs are opened at once. For editorial zen, you can full-screen your Portable Text Editor.

You can do so by hitting the expand editor at the top right (or hitting ⌘ + ⏎ (enter)) and clicking the top of each side panel to collapse them.

Thanks for reading

We've always said:

"Little incremental improvements are far more significant to the editorial experience than a singular big release." That's why we love Sanity for their constant efforts with QOL improvements.

Frequently asked questions

Does the Sanity Portable Text editor support markdown shortcuts?
Yes. Shortcuts landed just before the end of 2024 after being one of the top editorial requests of the year. If you are not on the auto-updating Sanity Studio, run npm i sanity@latest to pick them up.
Which markdown shortcuts work in Sanity's Portable Text editor?
Type the shortcut followed by a space: # through ###### for headings 1 to 6, > for a blockquote, 1. for an ordered list, and - or * for an unordered list.
Why does typing # not create a heading 1 in Sanity?
If you restricted H1 in your Portable Text configuration for SEO reasons, the shortcut has nothing to map to. A shortcut only works for styles that exist in your editor config, which is the pitfall we hit when first testing it.
How do I make text bold or italic in the Portable Text editor?
There is no markdown shortcut for those, but keyboard shortcuts exist. Highlight the text and press Cmd + B for bold or Cmd + I for italic.
How do I open the Sanity Portable Text editor in full screen?
Hit the expand editor button at the top right, or press Cmd + Enter, then click the top of each side panel to collapse them.
How do I update Sanity Studio to get the latest editor features?
Run npm i sanity@latest, or switch to the auto-updating Sanity Studio so you get releases like the markdown shortcuts without a manual update.

About the authors

Jono Alford

Founder of Roboto Studio, specializing in headless CMS implementations with Sanity and Next.js. A Sanity Pioneer and first-cohort Sanity Community Ambassador, focused on editorial experiences that help teams ship faster.

Sne Tripathi
Sne Tripathi

Account Executive

Account Executive at Roboto Studio, bridging the gap between client needs and technical solutions. Ensures every project delivers real business value.



Related posts





Get in touch

Tell us what you're building. We reply within one working day. Jono or someone on the team picks up every message personally.

By sending this you agree to our privacy policy. We only use your details to reply.