Open bacoords opened 3 months ago
If you want to give it a try, check out the __unstableInputRule
property for Code format.
Swapping the const BACKTICK = '`';
with const ASTERISK = '*';
should probably be enough for essential support.
Thanks for the pointer @Mamaduka ! - You're right that emphasis was easy enough. I am seeing that the harder part is that in markdown, a *single asterisk*
translates to <em>
but a **double asterisk**
translates to <strong>
so I think I need to put a little more logic for that.
IIRC formats can only support a single tagName
; based on that "limitation", your PR shouldn't be enough for the core.
A plugin can register a custom format that handles "strong importance" for a text.
I've updated the PR. There should only be a single tagName added- <em>
or <strong>
. There needed to be some additional logic in italic/index.js
to make sure that it worked correctly and I'll admit that I left the logic a bit more verbose so it could be more clear what was happening. Open to any suggestions on tightening it.
What problem does this address?
Right now Gutenberg has mixed support for markdown-style text shortcuts. You can use shortcuts to generate heading blocks (
#
), lists (-
), and the horizontal rule (---
). Using the ` (backtick) character will create an inline code tag for you. But there are a few others that could be helpful while writing.What is your proposed solution?
Similar to the way Gutenberg recognizes the backtick character and converts it to code, I would like to work on extending that support to emphasis as the scope of this issue.
The ideal result here would be that users could type a single or double asterisk
*
or underscore_
to get<em>
or<strong>
tags inline.https://daringfireball.net/projects/markdown/syntax#em