Formatted text in Viktor

This feature request is intended as a recap of what currently exists and what is missing with regards to formatting text in Viktor.

Description of the limitation and why it is relevant to address

As a developer, I want to freely format text in most Viktor objects (titles and fields).

From what I’ve seen and tested, there are 5 options to format text and write maths:

Formatting methods

1. Inline simple Maths

"**Length** → $a^2$"

outputs :

Lengtha^2

2. Block simple maths

"""
**Length** → $a^2$
"""

3. Inline complex maths

r"**Angle** $\theta_{sup}$")

outputs :

Angle: \theta_{sup}

4. Block complex maths

r"""
**Angle** $\theta_{sup}$
"""

5. Nested block

Markdown style

"""
**Angle**
    ```math
        \\theta_{sup}

    ```
"""

Formatting fields, texts, etc

However they only seem to work for certain types of viktor fields/outputs:

I think it would be great to be able to write formatted text in all these Viktor objects for increased readability for the end users. For developers, it can also be confusing which types of field/outputs are formattable and which aren’t.

Current workarounds

  1. Use special symbols (eg. “α”) directly from the internet, instead of using the Markdown method (eg. \alpha)
  2. Instead of using an OutputField, create multiple Text and use the visible argument to only make one appear.

Hi Remi,

Thank you for this extensive investigation on what can and cannot be formatted properly. I fully agree that we can work on making the rules more consistent.

1 Like