When writing a paragraph that contains escaped tildes, typing subsequent tildes does not work as expected. Specifically, if I have some text that uses a ` (tilde) like this, then pressing the ` key again later in the same paragraph causes the inline code span to toggle about.
The escaped ` is also problematic.
Copy-paste the following into the rich text editor to replicate it:
Specifically, if I have some text that `` uses a ` (tilde) `` like this,
then pressing the <kbd>\`</kbd> key again later in the same paragraph
causes the inline code span to toggle about.
The escaped \` is also problematic.
This is working as intended, the escaping is lost when parsed (when toggled from Markdown to rich text) and that’s expected as escaping with the \ is a markdown/code concept.
The supported way of escaping in rich editor mode is backspacing after the input rule takes place: `like this`.
Yes, this is a little better, but it’s still impossible to actually write any inline code that has a ` in it without some fiddling after first getting it wrong. You can’t preemptively use more than one `. Typing that ` from above or the escaped code that creates it (<kbd>\`</kbd>) are perfect examples of things that are nigh-impossible to do with the WYSIWYG mode, even with fiddling.
I get that you can backspace to undo formatting and implicitly “escape” it, but I have a hard time predicting when formatting will take affect. For example, `4*5*6` writes naturally when immediately preceded by that hanging-open `, but that’s not always the case. 4*5*6=120 types nicely but 120=456 doesn’t (the five was transiently italicized there).
What do you suggest we do in these specific cases? Do you have an example of another product that does it in a way we can take inspiration from?
You can type `, select it, then type ` or cmd+E to toggle it to inline mark.
You can hit cmd+Eand then type `. You can use cmd+E to toggle the code mark for the next character when typing, just the same you can with cmd+B for bold or cmd+I for italic.
The <kbd> input rule auto-selects an empty character (to keep the browser from auto-deleting an empty node), so you just have to deselect it first (because hitting ` in this case makes an inline mark of the selection – we can potentially remove that behavior, though, as we have cmd+E for this).
I understand those may not be ideal, but they are the compromises we have for all the particularities we have within Discourse. We’re open to suggestions, if you can share how you’d like it to work instead.
Well, I opened this topic when it was looking like enabling the WYSIWYG editor would make the markdown one monospace (cf Monospace font in the Markdown-only editor - #58 by mbauman ). I’m very glad that’s no longer the case and that this is now configurable, because, yeah, I’ve never met a markdown WYSIWYG editor I liked. This is getting close, though.
I write a lot of markdown in a lot of text-boxes (in both rendered and non-rendered contexts… to the point that I almost consider un-rendered markdown “formatted”), and I know I’m quite the outlier. I do think, though, that there’s a cluster of us outliers, and we tend to gather in the context of programming language forums.
The most valuable part is to make the auto-formatting as predictable as possible, so I can learn when I need to backspace, but that’s quite hard to learn in my experience.