Underscores shouldn't change formatting

Started by
5 comments, last by SyncViews 4 years, 3 months ago

This forum has a lot of coding related posts. Not everyone uses camelCase for all variable names, and if you have two snake_case variables anywhere in a post, the forum will by default automatically assume you want everything between them in italics. Even if the two are separated by multiple paragraphs. That makes absolutely NO sense on a forum like this. And while yes, code blocks certainly exist for longer pieces of code, I shouldn't need one every time I reference a variable name!

The same is true for pointers*

Advertisement

This really bugs me, it feels kinda like markdown syntax, only it's not and it does weird stuff. The markdown rules for * and _ seem to be fairly complex, presumably to deal with exactly this issue, including interactions with `inline code` (which be really nice if worked here).

_this is italics_. this_is_not. _this + is _not. _ this is not _

this * is italic * `this * is * not`

In many cases I just use notepad then copy/paste, as it seems the process for dealing with these style things is on typing, and not the overall text…, this also somehow messes up paragraph spacing but seems to be more reliable in general.

A basic challenge here is that right now the forum post editor is the same as the blog post editor, tutorial editor, etc.

I can see the argument for removing the auto-markdown in forum posts (converts markdown syntax as you type, like many popular platform editors), but the auto-markdown was a specific request for blog and tutorial editing where it is much more useful.

So, need to think about a solution here. There are other factors that have to be considered as well.

Admin for GameDev.net.

khawk said:
auto-markdown

If it is meant to be markdown, is it worth making a list of markdown things that don't work to fix? I was really under the impression it was only markdown inspired, as a lot of the syntax rules don't appear to apply (like leaving underscores alone with a character both sides, and not matching two “prefix” underscores).

For all the places the editor is used, presumably, same catches like going to do a little inline `std::tostring` and then oh no italics `std::unorderedmap`?

I'm not against it applying to pasted text either, and as such it could be useful, but only if is interpreted as expected as some quirks only seemed avoidable with pasting right now.

SyncViews said:
markdown inspired

It is, GFM inspired but not to a spec. It's intended to shorten editing time instead of standard word processor shortcuts or toolbar use. I definitely recognize it's not perfect.

My personal complaint is the inability to use inline code. Since this is effectively CKEditor 5's autoformat feature, I'll need to go custom to fix some of these issues (of course, first checking if they're already fixed and just need an update).

SyncViews said:
some quirks only seemed avoidable with pasting right now.

Pasting isn't handled the same as typed text. Yay, javascript.

It's on the list to allow markdown editing, but do so as an account option for your preferred editor. So is a plain text box with no formatting whatsoever.

Problem is a number of things need to be built around each supported editor - for example, in the case of a markdown editor, how to handle copy and paste of links, images, videos, embeds, etc. that the current editor allows; or, it's straight text and entirely up to you to provide image hosting, format links properly, etc. To a degree it's a general UX issue combined with resources to work on these things and some additional code plumbing.

Most likely, I'll look at how to fix the immediate need and leave the rest for lower priority (inline code, underscores in variable names, or both in one solution which seems more ideal anyway).

Admin for GameDev.net.

khawk said:
My personal complaint is the inability to use inline code. Since this is effectively CKEditor 5's autoformat feature, I'll need to go custom to fix some of these issues (of course, first checking if they're already fixed and just need an update).

Ah interesting, I actually reproduced a bunch of the things on their demo (which seems to have `inline code`) that caught me out, and found some issues on Github, but some years old.

Markdown autoformat italics bug
Autoformatting styles trigger within inline code

I also figured out some of the not-quite markdown things I thought just didn't work (e.g. I was trying <space>*<space>for a bullet point, which works on Google Docs / other places, and 4x indent for code). So just having a doc page stuck in front of me was useful in that regard.

This topic is closed to new replies.

Advertisement