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


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.

So you know what that means: if you're not already using the auto-updating Sanity Studio, make sure you run:

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.

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

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.


Get in touch

Book a meeting with us to discuss how we can help or fill out a form to get in touch