Code formatting
Asked Answered
W

15

0

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.

Wigwam answered 14/9, 2023 at 14:27 Comment(0)
T
0

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/.

Topic answered 14/9, 2023 at 15:12 Comment(0)
W
0

Topic 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.

Wigwam answered 14/9, 2023 at 15:27 Comment(0)
B
0

Wigwam 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.

Bashan answered 14/9, 2023 at 15:45 Comment(0)
V
0

Wigwam 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.

Vice answered 14/9, 2023 at 16:6 Comment(0)
W
0

Bashan 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.

Wigwam answered 15/9, 2023 at 19:35 Comment(0)
B
0

Wigwam 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.

Bashan answered 15/9, 2023 at 22:50 Comment(0)
W
0

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

Wigwam answered 15/9, 2023 at 23:5 Comment(0)
B
0

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.

Bashan answered 15/9, 2023 at 23:15 Comment(0)
T
0

IMHO, the forum should be rewritten in Godot.

Topic answered 16/9, 2023 at 0:3 Comment(0)
D
0

Topic That would be something, haha!

Delightful answered 16/9, 2023 at 0:9 Comment(0)
B
0

Topic 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...

Bashan answered 16/9, 2023 at 5:3 Comment(0)
L
0

Bashan 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!

Lassa answered 16/9, 2023 at 8:46 Comment(0)
T
0

Topic IMHO, the forum should be rewritten in Godot.

Um… is it basically possible to make a website and forum on Godot?

Bashan But then you are limiting people to browsing the forum via WebGL capable devices only.

Is that a very big limitation?

Throstle answered 16/9, 2023 at 10:27 Comment(0)
W
0

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 😃

Wigwam answered 16/9, 2023 at 11:40 Comment(0)
B
0

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.

Bashan answered 16/9, 2023 at 18:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.