Wouldn’t it be convenient to select a sentence or paragraph and instantly wrap it with quotes by tapping on the quote key? This is a fun little feature that was tucked into the Gutenberg 13.9 changelog last month with very little fanfare:
Rich text: Add character shortcuts for wrapping selection. (42469)
The new shortcut is a rich text feature contributed by Automattic-sponsored WordPress core committer Ella van Durpe. It works in a similar way that pasting a link over selection will auto-link the text instead of replace it, a feature that landed seven years ago which she also worked on.
The new quotes shortcut escaped my notice until I saw George Mamadashvili’s quick video demo on Twitter:
This is a clever feature that is commonly supported by IDE’s like IntelliJ and PyCharm. Although wrapping with quotes is likely the most common use case for this type of shortcut, it also supports wrapping the selection with a back tick (`
), which will automatically wrap it in a code tag instead of replacing the selection with a back tick. van Durpe demonstrated this in the PR with a gif:
If you frequently copy and paste text that is meant to be in quotes, or code that needs backticks, this new shortcut is a major timesaver and one of the most exciting features to land in 13.9. van Durpe said it was generalized to work with any characters, such as pressing (
to wrap the selection in parenthesis, instead of deleting the selection. However, this was scaled back a bit during the review before the PR was merged.
“I’m a bit worried with expanding these to characters that are natural openers because I suspect it’s a typical action to select a word and type the first letter of what should replace it — parentheses and quotation marks, in particular, would have a much higher incidence of cases where the intention is indeed to replace the selected text with the mark, not to wrap it in them,” Gutenberg lead architect Matias Ventura said.
Ventura concluded that it’s worth testing but suggested more characters be added incrementally to focus feature announcements on the ones they are more certain about “without the ones that could be problematic tainting the feature.” This is possibly the reason it wasn’t highlighted in the release post.
The backtick and quote characters are the only two included in this iteration of the feature. It’s not easy for users to discover in the natural course of using the editor, so it might need a little promotion for people to start using it enough to know if it’s going to become one of those indispensable features or something that is inadvertently causing frustration.