Forum Discussion

Anonymous's avatar
Anonymous
2 years ago

Plain text option in code widget or monospace font style option

Sometimes we need to paste in code output or text that shouldn’t be formatted the way normal text is formatted. We need either an “unformatted” language to choose from in the code widget, or we need a text option that is monospace (where every character takes up the same width so that indentation is rendered properly). For example, this log output looks like this in a code widget:

Using the code widget and choosing “not set”, which I expected to have no color coding.

This is not what it should look like. Interestingly, if I paste the same block of text here, it’s not color coded like it is in that post. This leads me to believe that all code blocks within the same post use the same language, even if the code widget is set to “not set”. 

>>> response = create_group("SDK Test",812,{"prop1":"1","prop2":"2"})
[2023-02-21 16:30:11] API SDK POST: Created resource group Customers/Longhorn Smokers/SDK Test (854)
>>> response = create_group("SDK Test",812,{"prop1":"1","prop2":"2"})
[2023-02-21 16:33:06] SUMMARY: Customers/Longhorn Smokers/SDK Test already exists in LM with all the correct properties, moving on...
>>> response = create_group("SDK Test",812,{"prop1":"1","prop2":"2"})
[2023-02-21 16:33:43] API SDK PATCH: Patched device group SDK Test
>>> debug = True
>>> info = True
>>> response = create_group("SDK Test",812,{"prop1":"1","prop2":"2"})
[2023-02-21 16:35:57] DEBUG: Group SDK Test exists in LM (854), checking if attributes match...
[2023-02-21 16:35:57] DEBUG: Property prop1 matches attribute already in LM
[2023-02-21 16:35:57] DEBUG: ================================================================================
[2023-02-21 16:35:57] DEBUG: prop1: 1
[2023-02-21 16:35:57] DEBUG: prop1: 1
[2023-02-21 16:35:57] DEBUG: ================================================================================
[2023-02-21 16:35:57] DEBUG: Property prop2 matches attribute already in LM
[2023-02-21 16:35:57] DEBUG: ================================================================================
[2023-02-21 16:35:57] DEBUG: prop2: 2
[2023-02-21 16:35:57] DEBUG: prop2: 2
[2023-02-21 16:35:57] DEBUG: ================================================================================
[2023-02-21 16:35:57] DEBUG: There is no AppliesTo that we want to patch in.
[2023-02-21 16:35:57] SUMMARY: Customers/Longhorn Smokers/SDK Test already exists in LM with all the correct properties, moving on...
[2023-02-21 16:35:57] DEBUG: 854: Customers/Longhorn Smokers/SDK Test: [{'name': 'prop2', 'value': '2'}, {'name': 'prop1', 'value': '1'}]
>>>
  • Seconded, Most of the solutions I end up posting contain code blocks and non-monospaced fonts make it very difficult to read.

  • Anonymous's avatar
    Anonymous

    Because LM didn’t write this community software. A11ey’s probably requested it, but unless it was built with extensibility in mind, I doubt we’ll see anything change there any time soon..

    I hadn’t noticed that powershell was not supported. That’s concerning.

  • A11ey's avatar
    A11ey
    Former Employee

    Sorry for the delay!  Ticket has been logged for this, if there is no solution I’ll submit an idea!

  • I just posted an excerpt from a LogicModule that I wrote, and I was surprised to see that Groovy is not an option for the language.

  • Anonymous's avatar
    Anonymous

    I’m not surprised, Groovy just isn’t that common outside certain circles. Just use Java, they’re basically the same, syntactically. 

  • I did pick Java.

    But LogicModules can only be written in two languages. How is it that they are not both supported by this code widget?

  • I hadn’t noticed that powershell was not supported. That’s concerning.

    Oooh, I hadn’t noticed that, either. Yikes!