A thread for serious bugs in the new forum

I'm unsure what you are inspecting. Let's try with this one:

/////////////////////////
int EEPROM.read(0, (uint16*)&S);
//////////////////////////

that's what I see

Again, as you could have seen in my image: it's a part of your message #133.

No, not again. I'm getting sick and tired of this forum and its bugs.

My answer 133 had no code tag…. But whatever. It’s a free world if you don’t want to check, that’s your call

I disagree with what you call a bug in this case.

Are you calling me a liar? Here's a screendump of your message #133:

I think we are lost in translation here. (And I’m saying I don’t get the scientific attitude to not explore remarks on a point you raised)

To be possibly clearer:

By code tag I mean the forums’ tags, what the user types in. Not what the forums parser generates to represent the user’s input.

What I am saying is that

  • if you only have the triple back quotes to mark the code area then double slashes then it appears that // are caught (as you show) as comments and grouped together in the html that gets generated
  • if you add cpp after the triple back quotes then it seems it’s parsed differently and generates the code you see in my screen capture. That’s why I provided a piece of code with the cpp for you to double check you have the same behavior in case the forum’s parser takes also into account the client browser or PC/Mac or OS

My point is that it’s auto-detection related and using cpp generates less verbose html

Discourse is using highlightjs.org to automatically highlight code blocks. If there are any performance issues, you might want to report to them.

That said, the post you linked has a code block but doesn't indicate what language it's in. So highlight.js is doing it's best to automatically detect what it is and detected that it is some perl. That's why the code highlighting is a bit off.

As for the large number of <span> tags, if you have a better way to handle code highlighting in HTML, I'm sure they would be more than happy to hear about it :wink:

That's because you didn't properly close the [code] block with [/code]... You entered [code] so I fixed it in your post and it works just fine now.

1 Like

So it should default to no particular language, not to perl or any other language. Just use a real code (or pre) tag to produce HTML and copy the contents. No need for syntax highlighting, so no need for 3 dozen span tags either.

I'd rather not have any code highlighting at all. Personally, that is.

I was irritated, which led to making (a) mistake(s). Sorry about that.

That’s the thing. As no language was indicated the auto detect did its thing and failed to pick C++. It seems some parsers are better than other though as cpp would do a better job for the comment written that way

That was the point of my example above

That's my feeling as well; just copy verbatim in something like pre tags.

Autodetection is a nice feature, and will often fail especially on small snippets. I think it would be a loss to not have the feature for larger pieces of code though.

The API offers a relevance score so may be this should be used to further determine which langage to go for as well as the length of the code. A short code or poor score could indeed default to pre tags and then we would have the best of both worlds

If auto detection does not work properly, it's a useless feature :wink: Just my opinion.

the longer the code, the better it works. it goes hand in hand with "Don't post snippets" (Snippets R Us!) :slight_smile:

Which translates to: "it will work sometimes, but not always". There's a word for that in the dictionary: unreliable.

I don't even see this as a serious bug (title of this thread) if tons of <span> might be generated if you posted a snippet. It does look kinda OK in the end, is not slow on my Mac and the forum is usable for me. It's an optimization opportunity

The API gives you a relevance score, no guarantee. The business logic which decides what to do with this could be improved probably (when in doubt and if C++ is a possibility or when relevance is low, the parser could make the assumption it's C++ given that's the language used for Arduino programming and this forum is mainly for Arduino's question) or go for <pre>.

that's the various looks: (and I must admit it's a poor C++ statement, why is there int in front ?)

with <pre>

/////////////////////////
int EEPROM.read(0, (uint16*)&S);
//////////////////////////

with ```

/////////////////////////
int EEPROM.read(0, (uint16*)&S);
//////////////////////////

with ```cpp

/////////////////////////
int EEPROM.read(0, (uint16*)&S);
//////////////////////////

1 Like

I don't see any options for controlling the code language autodetect threshold in the forum settings.

There is a "autohighlight all code Force apply code highlighting to all preformatted code blocks even when they didn't explicitly specify the language." option though. If we disable that, then highlighting will only be applied when the poster explicitly specifies the language by appending the language code to the code fencing:

```cpp
void setup() {
```

If you want to advocate for that "autohighlight all code" setting to be disabled, I would recommend creating a dedicated forum topic.

Although there is no established formal process in place, it seems to me that if there is to be any chance of the community getting changes made to a forum setting, we will need to demonstrate that there is significant support for the proposal before presenting it to those who can make the decision. That will be easiest to accomplish by consolidating all the feedback to a dedicated topic, rather than it being mixed in with unrelated discussion.

A poll might be useful if you can get people to use it instead of of only replying with their opinion (of course replying in addition to filing a poll is perfectly fine).

my 2cts : if we could get newbies to learn about and use code tags in the first place, THAT would be an improvement...

1 Like

Yeah, one thing we must consider is that expecting newcomers to add a language code is completely unreasonable. We are lucky to get them to click the </> button. So turning off autohighlighting means that only code from the most experienced and dedicated forum members will have highlighting. All the rest will be purely black text on a gray background.

I can see good reasons for leaving autohighlighting on and good reasons for turning it off. I am leaning towards preferring that it was turned off at the moment, but I don't have a strong opinion on the matter.

Is there any way the software could examine the post-to-be for 'looks like code' text and, if found suggest to the poster "It looks like you're adding code to your post. If so, please format the text inside code tags using the </> symbol."  Or words to that effect.

I'm not talking about one liners and snippets here.  I assume a scanner would need more material to work with.

If doable it sure would cut down the clutter.

1 Like

We went down this road with the SMF version of the forum.
Consensus in the back room was that it could be a very time consuming and certainly expensive path.

So many things would have to be parsed by any scanner and it was felt that many common words would be intercepted as code when in fact they were not.

My own view at the moment is that we are certainly better off than we were.
More posters appear to be getting the basics correct in terms of where, what, and how they post etc.
As a moderator I have been surprised and very happy at the lower workload.
More so as they discover @discobot

As users reach higher trust levels I would like to see the ability of those trusted experienced users to be able to make minor edits to posts from OP's.
That ability is one we do have on tap along with CANNED REPLIES.

I am afraid that is not my experience.

Common mistakes are posting in the Introductory Tutorials section, not posting full or even any code, not posting error messages, not using code tags when posting either and posting in the main forum (often along with one of the above problems) when the International section in their own language would be more appropriate

It seems to me that it is getting worse not better and is, in fact, worse that it was on the SMF platform for some reason

The automatic screening of messages to spot possible spammers does help, and as I get more used to the moderator functions things are getting easier but new users are still doing silly things