arduino / forum-assets

Tracker and collaborative development of Arduino Forum assets
https://forum.arduino.cc/
Creative Commons Zero v1.0 Universal
2 stars 9 forks source link

HTML color tags being automatically added to posted code #316

Closed UKHeliBob closed 3 years ago

UKHeliBob commented 3 years ago

HTML color tags embedded in pasted code

On several occasions I have seen code posted in code tags that has HTML color tags embedded in it, which makes copying it for examination in an editor difficult

The following actions will illustrate how the problem arises:

Set your profile to use the WYSIYWYG editor in Reply Reply to a topic and click on the code tag icon A grey input field will appear Use [select] to select the code from a code block in another post Paste the selected code into the grey coloured WYSIYWYG code field Preview the post and color tags will have been inserted like this

[color=#222222][/color]

include [color=#222222][/color]

Posting the reply leaves the color tags in the code. Such color tags make it very difficult to provide help with the posted code

UKHeliBob commented 3 years ago

I understand that this problem has been rejected as the WYSIWYG editor is "behaving as intended". If that is the case then I am appalled

The ability to post code in a convenient format is crucial to what is at its heart a forum about programming. The use of [code] tags when not using the reply editor in WYSIWYG mode puts the code text in a convenient scrolling box from which it can be quickly copied for examination in an editor or the IDE. Use of [code] tags also prevents elements of the code being interpreted as HTML tags which causes text to turn into italics and/or for smileys to be embedded in the code, both of which make the code nonsense.

When using the WYSIWYG editor when the [code] icon is used then the code text has a multitude of [color] tags added to it, thus nullifying the benefit of using them. This means that if the code is copied for examination it needs considerable effort to remove the [color] tags before sense can be made of it or it can be compiled

If this is indeed working as intended then the intentions are wrong

It has also been reported that the problem only occurs when using the WYSIWYG editor which I interpret as meaning only when Reply is used as opposed to Quick Reply. This is simply not true as there is a user profile option to use the full editor in Quick Reply and if this is ticked the problem then occurs in Quick Reply too. The formatting icons which are available when using the full editor are too important for them not to be available when composing a reply, hence the use of the option

SUMMARY If the WYSIWYG option is turned on then both Reply and Quick Reply are unsuitable for posting code in a programming forum which is a very sad state of affairs

BallscrewBob commented 3 years ago

See also https://forum.arduino.cc/index.php?topic=714401.0

UKHeliBob commented 3 years ago

Is there any prospect of this being fixed in the near future ?

This bug makes the use of code tags a total nonsense when a user has the WYSIWYG forum editor option turned on, then time is wasted explaining to the user what is wrong and how to fix it then they waste time having to post the code again. I have done this twice today already

If there is no intention to fix the bug then please say so in reply to this update

UKHeliBob commented 3 years ago

This bug continues to be a problem

I have seen a number of posts recently where code posted in code tags has been made unusable due to the [color] tags added by the forum software, for example https://forum.arduino.cc/index.php?topic=721784.

We ask posters to use code tags to make things easier only to have the forum software make things much worse

This situation is intolerable

UKHeliBob commented 3 years ago

void loop() {[color=#222222][/color] [color=#222222][/color] digitalWrite(41,HIGH); //transmit mode[color=#222222][/color] Serial1.print("VALAR\r"); // send command Serial1.flush(); // to complete the transmission [color=#222222][/color] digitalWrite(41,LOW); // receiver mode[color=#222222][/color] incomingByte = Serial.read(); //receive the string[color=#222222][/color] recvWithEndMarker_Conductivity();[color=#222222][/color] if (newData_Conductivity == true) {[color=#222222][/color] strcpy(tempChars_Conductivity, receivedChars_Conductivity);[color=#222222][/color] // this temporary copy is necessary to protect the original data[color=#222222][/color] // because strtok() used in parseData() replaces the commas with \0[color=#222222][/color] parseData_Conductivity();[color=#222222][/color] showParsedData_Conductivity();[color=#222222][/color] newData_Conductivity = false;[color=#222222][/color] }[color=#222222][/color] [color=#222222][/color] }

per1234 commented 3 years ago

Hi @UKHeliBob. Thanks so much for reporting this serious bug. I'm going to say that this was fixed by the switch to the Discourse forum. If anyone spots new occurrences of this bug, please comment here and I'll reopen. I'll be keeping my eyes open for it as well.