Closed vokiel closed 4 years ago
That's certainly and issue with the auto-formatting feature and we must report it at CKEditor 5.
One could say that auto-formatting should be triggered only if the opening marker(_
) is in a word boundary. It would not solve all cases, but it would help.
Auto-formatting can be undone, by pressing ctrl/cmd+z
right after the formatting happens. It has its learnability issue, but it's hard to say if this will be seen as a bug or an enhancement.
I would rather use the _
as an opening/closing for the auto-formatting only on the beginning/end of the word respectively. Underscore inside a word should be treated as a regular character.
This case is especially visible here on GH in inline code as it is not possible to format only a part of the code.
Yup, upstream issue. Similar to https://github.com/ckeditor/ckeditor5/issues/5862. And perhaps exactly this: https://github.com/ckeditor/ckeditor5/issues/1239.
The minimum thing to do would be to disable all automatic things happening inside code blocks and inline code. An even better solution would be to make the opening _
work only when used at the beginning of some word and closing _
only at the end of a word, but that's more tricky.
and closing
_
only at the end of a word
I think we're able to check only the start, because the end _
, which triggers auto-formatting, happens when the user is typing and we don't know what will be typed next.
I'm considering disabling auto-formatting for italics when typing underscore, for the time being. It is a character used way too often and having such feature seems to cause more harm that good.
WDYGT?
I'm considering disabling auto-formatting for italics when typing underscore, for the time being. It is a character used way too often and having such feature seems to cause more harm that good.
I've decided to go a longer way and reviewed the auto-formatting totally. For more information, check out #105.
TC
Start typing in a paragraph with some underscore inside the text, like:
Continue typing something with
_
inside.Expected: nothing changes.
Current: the whole part from the first
_
get italic until the second one, the underscore disappears: