Ckeditor5: Do not auto format after ` (backtick)

Created on 3 Jun 2020  ·  4Comments  ·  Source: ckeditor/ckeditor5

_This is a followup after https://github.com/ckeditor/ckeditor5/issues/1239#issuecomment-635281777_

📝 Provide detailed reproduction steps (if any)

  1. Type: `foo_bar_`

✔️ Expected result

One may expect to get `foo_bar_`: <code>foo_bar_</code>

❌ Actual result

foobar

2020-06-03 13 15 07

📃 Other details

This is related to https://github.com/ckeditor/ckeditor5/issues/7364.

If we state that we do not follow GH, Slack, Notion convention, one may say, that this is not a bug, but a feature, to create emphasis in code element (which is not available otherwise). Some folks seem to want to style in code elements: https://github.com/ckeditor/ckeditor5/issues/1239#issuecomment-619984252, @neongreen:

Do you think that inline styles like bold or italic should in general be available in \

I think they should ideally be available not only in inline code, but also in code blocks. This is useful for rich code snippets in tutorials — highlighting some part of the snippet for the reader, etc.

Did you mean they should be available via autoformatting, or are you fine with making them available only via explicit command (select + toolbar button click)?

//cc @oleq


If you'd like to see this fixed sooner, add a 👍 reaction to this post.

uux autoformat ux bug

Most helpful comment

Did you mean they should be available via autoformatting, or are you fine with making them available only via explicit command (select + toolbar button click)?

Only via explicit command. _, *, # are all characters common in code and I'd hate to fight the editor to enter them in inline code or code blocks.

All 4 comments

Did you mean they should be available via autoformatting, or are you fine with making them available only via explicit command (select + toolbar button click)?

Only via explicit command. _, *, # are all characters common in code and I'd hate to fight the editor to enter them in inline code or code blocks.

Thanks for the fast feedback :)

If someone wants to create an italic inside a code block... personally, I see nothing wrong with it (there could be use-cases) and I think the editor should allow this using toolbar buttons (code command enabled in italic and vice-versa).

But when it comes to autoformatting, if you typed foo `bar[] then most likely you're creating a simple inline code and whatever text is inside of it (without white spaces) should not create a nested formatting. 

I think Slack is a good example:

  1. type foo `bar[], type _baz_, results in foo `bar_baz_`
  2. type foo `bar[], type  _baz_, results in foo `bar _baz_`

I'm not 100% sure if Slack's behavior is a perfect either, imagine trying to write, the following code some_boolean_flag && _private_with_snake_case.

But, I totally agree it's better than the current behavior :)

Was this page helpful?
0 / 5 - 0 ratings