Why does the forum add {1} into CODE
-
I've found that often when copying and pasting things into CODE blocks, the forum adds {1} into areas where there is a line break.
But not always?
I've tried setting my the temp editor to use Linux style line breaks (CR) instead of (CR/LF), but I can't seem to crack what the cause is and more importantly how to avoid it? -
That's a good question. Sometimes it seems to do it, and sometimes not.
If you have a sample of copy and paste that can reliably cause it can you upload that file?
-
I think I've worked it out.
It's a bug in the syntax highlighter.
It seems to occur on any line break following a quoted string "some text"
This is original where some lines have quoted text as is required.if move.axes[0].homed !=true || move.axes[1].homed !=true || move.axes[2].homed !=true echo "Homing" M291 P"Homing required. Please wait" R"Homing" S1 T3 G28 ; home all if required echo "Creating cold bed map" M291 P"Creating cold bed map" R"Cold Map" S1 T3 G29 S0 ; create bed mesh if result !=0 M140 S0 R0 ; set active and standby temps to zero M140 S-276 ; turn off bed abort "Failed to create height map" G29 S3 P{var.ColdBedMap} ; save mesh to separate file if result !=0 abort "Failed to create height map" G29 S2 ; clear height map echo "Heating for nextmap" M291 P"Heating for next map" R"Heating" S1 T3 M190 R{var.LowTemp} M116 H0 S{var.TempTolerance}; wait for any temp changes on bed to be within X degrees of target echo "waiting for temp to stabilise" G4 S{var.SoakTime} echo "Creating low temp bed map" M291 P"Creating low temp bed map" R"Low Temp Map" S1 T3 G29 S0 ; create bed mesh
VS
This is same code with all " charectors replaced by *if move.axes[0].homed !=true || move.axes[1].homed !=true || move.axes[2].homed !=true echo *Homing* M291 P*Homing required. Please wait* R*Homing* S1 T3 G28 ; home all if required echo *Creating cold bed map* M291 P*Creating cold bed map* R*Cold Map* S1 T3 G29 S0 ; create bed mesh if result !=0 M140 S0 R0 ; set active and standby temps to zero M140 S-276 ; turn off bed abort *Failed to create height map* G29 S3 P{var.ColdBedMap} ; save mesh to separate file if result !=0 abort *Failed to create height map* G29 S2 ; clear height map echo *Heating for nextmap* M291 P*Heating for next map* R*Heating* S1 T3 M190 R{var.LowTemp} M116 H0 S{var.TempTolerance}; wait for any temp changes on bed to be within X degrees of target echo *waiting for temp to stabilise* G4 S{var.SoakTime} echo *Creating low temp bed map* M291 P*Creating low temp bed map* R*Low Temp Map* S1 T3 G29 S0 ; create bed mesh
-
In further news, I recalled that you can set the syntax file the highlighter used
e.g```perl gcode here ```
This seems to fix the issue using pretty much any syntax language file I could guess
e.g.
bash
perl
python
jsonPerhaps it would be wise to change the default that the forum uses to avoid this issue.
This one uses perl
if move.axes[0].homed !=true || move.axes[1].homed !=true || move.axes[2].homed !=true echo "Homing" M291 P"Homing required. Please wait" R"Homing" S1 T3 G28 ; home all if required echo "Creating cold bed map" M291 P"Creating cold bed map" R"Cold Map" S1 T3 G29 S0 ; create bed mesh if result !=0 M140 S0 R0 ; set active and standby temps to zero M140 S-276 ; turn off bed abort "Failed to create height map" G29 S3 P{var.ColdBedMap} ; save mesh to separate file if result !=0 abort "Failed to create height map" G29 S2 ; clear height map echo "Heating for nextmap" M291 P"Heating for next map" R"Heating" S1 T3 M190 R{var.LowTemp} M116 H0 S{var.TempTolerance}; wait for any temp changes on bed to be within X degrees of target echo "waiting for temp to stabilise" G4 S{var.SoakTime} echo "Creating low temp bed map" M291 P"Creating low temp bed map" R"Low Temp Map" S1 T3 G29 S0 ; create bed mesh
-
-
@owend
Good catch Owen!
I read lately, that some guy wrote a gcode syntax highlighter for the forum. I didn't knew what that meant, so forgot mostly about it. Would be interesting to try that one in this context.//edit found him
-
@droftarts et al
I have worked out a work around for this - it should prevent future code blocks from having the issue - but will not go back and replace existing code in existing posts.
I think this is limited to some keywords within the quotes as well as the quotes them selves and is a bug with the SQL and PHP autodetection highlighter line numbers are set:
Turn of line number for SQL and PHP:
so since we don't post SQL/PHP on this forum then turning off the line numbering wont impact anyone .
If the autodetection detects your post code as SQL/PHP then force it to be JSON or something
"special words & order: map, create " arbitrary text
.