How to use code fences

Tags: #<Tag:0x00007f61732b2330>

Hi Rich,

Maybe some screen shot with the icons would help others:
For example:

Screenshot-2018-3-16%20How%20to%20use%20code%20fences

I would be happy to make the others, where should I post them?

Good idea. I’ve made the original posting into a wiki. You can add the screenshots and makes any other changes now.

Done, thank you

I found a bug! :bug:

On MacOS Mojave you can’t see:

*.rules code fences icon
*.sitemap code fences icon
JavaScript code fences icon
generic code fences icon

1 Like

Same on Ubuntu 2 latest Firefox updates

1 Like

image

(or this was done on purpose by the forum Admins not to confuse users and make it easier for them to use the *.items code fences? … it’s a mystery ! :smiley:)

Hmm. I never even realized there were icons. LOL I always go old school and just manually type the beginning and ending ```

1 Like

Enclose your configs in:

<code>
This is my config
</code>

Note: Additional markdown for whoever is interested: https://commonmark.org/help/

The above will become:

This is my config

1 Like

Maybe that custom plugin does not work anymore …

If you check using F12 in Chrome (dev tools) you will see that some of the svg icons are missing… (I think) so the plugin may need some maintenance. good catch @sihui

We need @ThomDietrich back ! :smiley:

updated first wiki post to show immediately how to use the generic code fences

edit: added the <code> html flavor also on the table that shows up on the first page

1 Like

I need your advice on how to properly include long log in a post.

I have used the “Hide details” option of this editor to avoid having page long post but then the code fence does not seem to have effect on the hidden text.

I have seen some topics using fixed size blocks in which your can scroll horizontally and vertically the code/text but I have no idea how to include such block in this editor

Highlight your text and use the grafik button. Make sure you have an empty line before and after your code:

Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code Here goes your code

Next line …

Thanks but my log has 100 lines and I would like to have a smaller size block (let say 20 lines) in which the reader could scroll vertically through.

Will that happen automatically with the </> feature?

Yes, but it depends on the overall length of your code. You also can combine them with the “Hide details” function: first use the hide details, then the preformatted text:

Summary
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.1272019-11-10 22:29:50.595 [vent.ItemStateChangedEvent] - ESP8266_Five_Lux_Update changed from 0 lx (So, 22:28) to 0 lx (So, 22:29)
2019-11-10 22:29:50.598 [ome.event.ItemCommandEvent] - Item 'ShutterLuxWestDetected_Proxy' received command OFF
2019-11-10 22:29:54.646 [vent.ItemStateChangedEvent] - TemperatureShadow_Update changed from 4,0 °C (So, 22:28) to 4,0 °C (So, 22:29)
2019-11-10 22:29:54.650 [vent.ItemStateChangedEvent] - Shading_tempDiff_Proxy_Update changed from -0,2 °C (So, 22:28) to -0,2 °C (So, 22:29)
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.1272019-11-10 22:29:50.595 [vent.ItemStateChangedEvent] - ESP8266_Five_Lux_Update changed from 0 lx (So, 22:28) to 0 lx (So, 22:29)
2019-11-10 22:29:50.598 [ome.event.ItemCommandEvent] - Item 'ShutterLuxWestDetected_Proxy' received command OFF
2019-11-10 22:29:54.646 [vent.ItemStateChangedEvent] - TemperatureShadow_Update changed from 4,0 °C (So, 22:28) to 4,0 °C (So, 22:29)
2019-11-10 22:29:54.650 [vent.ItemStateChangedEvent] - Shading_tempDiff_Proxy_Update changed from -0,2 °C (So, 22:28) to -0,2 °C (So, 22:29)
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.1272019-11-10 22:29:50.595 [vent.ItemStateChangedEvent] - ESP8266_Five_Lux_Update changed from 0 lx (So, 22:28) to 0 lx (So, 22:29)
2019-11-10 22:29:50.598 [ome.event.ItemCommandEvent] - Item 'ShutterLuxWestDetected_Proxy' received command OFF
2019-11-10 22:29:54.646 [vent.ItemStateChangedEvent] - TemperatureShadow_Update changed from 4,0 °C (So, 22:28) to 4,0 °C (So, 22:29)
2019-11-10 22:29:54.650 [vent.ItemStateChangedEvent] - Shading_tempDiff_Proxy_Update changed from -0,2 °C (So, 22:28) to -0,2 °C (So, 22:29)
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.1272019-11-10 22:29:50.595 [vent.ItemStateChangedEvent] - ESP8266_Five_Lux_Update changed from 0 lx (So, 22:28) to 0 lx (So, 22:29)
2019-11-10 22:29:50.598 [ome.event.ItemCommandEvent] - Item 'ShutterLuxWestDetected_Proxy' received command OFF
2019-11-10 22:29:54.646 [vent.ItemStateChangedEvent] - TemperatureShadow_Update changed from 4,0 °C (So, 22:28) to 4,0 °C (So, 22:29)
2019-11-10 22:29:54.650 [vent.ItemStateChangedEvent] - Shading_tempDiff_Proxy_Update changed from -0,2 °C (So, 22:28) to -0,2 °C (So, 22:29)
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.1272019-11-10 22:29:50.595 [vent.ItemStateChangedEvent] - ESP8266_Five_Lux_Update changed from 0 lx (So, 22:28) to 0 lx (So, 22:29)
2019-11-10 22:29:50.598 [ome.event.ItemCommandEvent] - Item 'ShutterLuxWestDetected_Proxy' received command OFF
2019-11-10 22:29:54.646 [vent.ItemStateChangedEvent] - TemperatureShadow_Update changed from 4,0 °C (So, 22:28) to 4,0 °C (So, 22:29)
2019-11-10 22:29:54.650 [vent.ItemStateChangedEvent] - Shading_tempDiff_Proxy_Update changed from -0,2 °C (So, 22:28) to -0,2 °C (So, 22:29)
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.1272019-11-10 22:29:50.595 [vent.ItemStateChangedEvent] - ESP8266_Five_Lux_Update changed from 0 lx (So, 22:28) to 0 lx (So, 22:29)
2019-11-10 22:29:50.598 [ome.event.ItemCommandEvent] - Item 'ShutterLuxWestDetected_Proxy' received command OFF
2019-11-10 22:29:54.646 [vent.ItemStateChangedEvent] - TemperatureShadow_Update changed from 4,0 °C (So, 22:28) to 4,0 °C (So, 22:29)
2019-11-10 22:29:54.650 [vent.ItemStateChangedEvent] - Shading_tempDiff_Proxy_Update changed from -0,2 °C (So, 22:28) to -0,2 °C (So, 22:29)
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.1272019-11-10 22:29:50.595 [vent.ItemStateChangedEvent] - ESP8266_Five_Lux_Update changed from 0 lx (So, 22:28) to 0 lx (So, 22:29)
2019-11-10 22:29:50.598 [ome.event.ItemCommandEvent] - Item 'ShutterLuxWestDetected_Proxy' received command OFF
2019-11-10 22:29:54.646 [vent.ItemStateChangedEvent] - TemperatureShadow_Update changed from 4,0 °C (So, 22:28) to 4,0 °C (So, 22:29)
2019-11-10 22:29:54.650 [vent.ItemStateChangedEvent] - Shading_tempDiff_Proxy_Update changed from -0,2 °C (So, 22:28) to -0,2 °C (So, 22:29)
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.1272019-11-10 22:29:50.595 [vent.ItemStateChangedEvent] - ESP8266_Five_Lux_Update changed from 0 lx (So, 22:28) to 0 lx (So, 22:29)
2019-11-10 22:29:50.598 [ome.event.ItemCommandEvent] - Item 'ShutterLuxWestDetected_Proxy' received command OFF
2019-11-10 22:29:54.646 [vent.ItemStateChangedEvent] - TemperatureShadow_Update changed from 4,0 °C (So, 22:28) to 4,0 °C (So, 22:29)
2019-11-10 22:29:54.650 [vent.ItemStateChangedEvent] - Shading_tempDiff_Proxy_Update changed from -0,2 °C (So, 22:28) to -0,2 °C (So, 22:29)
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.1272019-11-10 22:29:50.595 [vent.ItemStateChangedEvent] - ESP8266_Five_Lux_Update changed from 0 lx (So, 22:28) to 0 lx (So, 22:29)
2019-11-10 22:29:50.598 [ome.event.ItemCommandEvent] - Item 'ShutterLuxWestDetected_Proxy' received command OFF
2019-11-10 22:29:54.646 [vent.ItemStateChangedEvent] - TemperatureShadow_Update changed from 4,0 °C (So, 22:28) to 4,0 °C (So, 22:29)
2019-11-10 22:29:54.650 [vent.ItemStateChangedEvent] - Shading_tempDiff_Proxy_Update changed from -0,2 °C (So, 22:28) to -0,2 °C (So, 22:29)
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.1272019-11-10 22:29:50.595 [vent.ItemStateChangedEvent] - ESP8266_Five_Lux_Update changed from 0 lx (So, 22:28) to 0 lx (So, 22:29)
2019-11-10 22:29:50.598 [ome.event.ItemCommandEvent] - Item 'ShutterLuxWestDetected_Proxy' received command OFF
2019-11-10 22:29:54.646 [vent.ItemStateChangedEvent] - TemperatureShadow_Update changed from 4,0 °C (So, 22:28) to 4,0 °C (So, 22:29)
2019-11-10 22:29:54.650 [vent.ItemStateChangedEvent] - Shading_tempDiff_Proxy_Update changed from -0,2 °C (So, 22:28) to -0,2 °C (So, 22:29)
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.1272019-11-10 22:29:50.595 [vent.ItemStateChangedEvent] - ESP8266_Five_Lux_Update changed from 0 lx (So, 22:28) to 0 lx (So, 22:29)
2019-11-10 22:29:50.598 [ome.event.ItemCommandEvent] - Item 'ShutterLuxWestDetected_Proxy' received command OFF
2019-11-10 22:29:54.646 [vent.ItemStateChangedEvent] - TemperatureShadow_Update changed from 4,0 °C (So, 22:28) to 4,0 °C (So, 22:29)
2019-11-10 22:29:54.650 [vent.ItemStateChangedEvent] - Shading_tempDiff_Proxy_Update changed from -0,2 °C (So, 22:28) to -0,2 °C (So, 22:29)
2019-11-10 22:29:54.651 [ome.event.ItemCommandEvent] - Item 'ShutterTempDetected_Proxy' received command OFF
2019-11-10 22:29:57.017 [vent.ItemStateChangedEvent] - Barometer changed from 1015.125 to 1015.127
1 Like

Great thanks

Using code fences does this by default

```
Really long code or logs go here
```
3 Likes

Here is a test post which I will delete once I am done :

sitemap home label="Uberboltonwagen"
{Frame label="Lights" {
				Switch item=channel1 label="Desk"
				Switch item=channel2 label="Bed Reading"
                Switch item=channel3 label="Bathroom"
				Switch item=channel4 label="Bed Space"
                //Switch item=channel5 label="TBA1"
				Switch item=channel6 label="Outside"
                //Switch item=channel7 label="TBA3"
				Switch item=channel8 label="Galley"
                }   
}

Using the BB Formatting tool:

sitemap home label="Uberboltonwagen"
{Frame label="Lights" {
				Switch item=channel1 label="Desk"
				Switch item=channel2 label="Bed Reading"
                Switch item=channel3 label="Bathroom"
				Switch item=channel4 label="Bed Space"
                //Switch item=channel5 label="TBA1"
				Switch item=channel6 label="Outside"
                //Switch item=channel7 label="TBA3"
				Switch item=channel8 label="Galley"
                }   
}

TABing wont work so I guess that must be correct before you copy

sitemap home label="Uberboltonwagen"
{Frame label="Lights" {
				Switch item=channel1 label="Desk"
				Switch item=channel2 label="Bed Reading"
                                Switch item=channel3 label="Bathroom"
				Switch item=channel4 label="Bed Space"
                              //Switch item=channel5 label="TBA1"
				Switch item=channel6 label="Outside"
                              //Switch item=channel7 label="TBA3"
				Switch item=channel8 label="Galley"
                }   
}

I often see complaints that people aren’t using code fences when requesting help.

I’m using Firefox (77.0.1 (64-bit)) on Ubuntu (18.04), and this is what my edit panel looks like:

All the code fence icons are gone! The links are still there (you can tell if you hover over them). Is this very specific to Firefox on Ubuntu?

Hi @hafniumzinc,

I see this behavior on MacOSX (10.15.4) with Chrome, Microsoft Edge, and other browsers. As mentioned above if I hover over where the icons should be, I get text indicating the usage of the code fences.

Regards,
Burzin

1 Like