Something should be done about code formatting functionality on the forum. Every single newcomer screws it up when asking questions about their code snippets. Tbh it's not really their fault. The default behavior of insert code button facilitates this. Here's my observation of how it currently works. When you press insert code button the following will happen:

  • if nothing is selected, the editor will insert single quotes for inline code markup and position the cursor inside the quotes
  • if a single line is selected, the editor will put single quotes for inline code markup around the selection
  • if multiple lines are selected the editor will put triple quotes for block code markup around the selection

So the "expected" way to insert a block of code via gui is to paste the block, select it, and then press the insert code button. However looks like nobody does it like this, and the button's misleading tooltip contributes to this.

People are first clicking the button (because, yeah, they want to insert the code) and then paste the code block. But doing it like that will always insert inline code tags, screwing the block's formatting.

Since in 99% of cases people want to post block and not inline code, the behavior of the insert code button should be changed so it inserts ~~~ if nothing is selected.

    The problem is aggravated by the fact that it works differently in different places, e.g. here vs. Reddit vs. Discord vs. github vs. stayathomedev.com/godotforums/.

    • xyz replied to this.

      DaveTheCoder I'm pretty sure that most people do exactly what I described; they press the insert code button and then paste. Why not accommodate that and see if things improve. Hopefully the platform allows for easy customization of this.

        xyz I'm pretty sure that most people do exactly what I described; they press the insert code button and then paste. Why not accommodate that and see if things improve. Hopefully the platform allows for easy customization of this.

        Alas, much as I agree with you, this is a question to ask Flarum developers, or vanilla developers which is the forum software we had used previously. Both have opted to do it the same. I don't really know why.

        And I can attest, a lot of my time moderating was taken up by just fixing the formatting of new user posts back when I was the forum janitor.

        • xyz replied to this.

          xyz This is great feedback! Let me see what I can do. I'll do some investigating.

          Before, there also used to be a "how to use the forum" thread written for the previous platform. To update that or re-write it to be up to date is also on the to-do list (to be included in the onboarding thread). But to make the code formatter smart enough to recognize what to use depending on the input from the user. That would be great. If it's not supported, then perhaps creating a plugin that's capable of handling it would be something.

          I'll look into it.

          Megalomaniak Alas, much as I agree with you, this is a question to ask Flarum developers, or vanilla developers which is the forum software we had used previously. Both have opted to do it the same. I don't really know why.

          They probably chose what looked most logical to them. But in practice the user culture and behavior may vary between communities, depending on demographics. So I think customizing/adapting to actual observed behavior is the way to go.

            xyz Yeah, probably. At least in case of Vanilla I know the markdown editor was a plugin so def. customizable. I'm not familiar enough with flarum but maybe it is reasonably doable. The downside is it becomes tech debt to maintain a custom form of the plugin.

            • xyz replied to this.

              Megalomaniak Maybe the Flarum devs could be directly contacted regarding the issue.

              Yeah, I'd probably give that a try before resorting to a custom fork, also trying to dig through the flarum source (only quickly tho) I didn't find a plugin for the editor, seems core. But that doesn't mean a editor replacer plugin is necessarily impossible.

              DaveTheCoder IMHO, the forum should be rewritten in Godot.

              You likely jest but I wont deny the thought may have run through my mind too a couple of years ago. But then you are limiting people to browsing the forum via WebGL capable devices only. So while a cool idea I sadly don't think it's really viable. Well, yet anyways.

              Now a godot plugin that would put a forum right inside of the godot editor on the other hand...

                Megalomaniak Now a godot plugin that would put a forum right inside of the godot editor on the other hand...

                Now we're thinking with portals!

                Hey, we can't fix the code formatting glitch but we can instead port the whole forum to webgl. That's the true engineering spirit right there. LOL 😃

                Lots of people browse via phones and lot of people might want to use an old laptop to browse with while using godot on their main system. Old HW can have issues with WebGL.