Skip to main content

Formatting text

In certain parts of the platform, user-defined text can be formatted using Markdown, a simple and easy-to-use markup language. See the basic Markdown syntax guide or try the 10-minute interactive Markdown tutorial to learn more.

Where formatted text is supported

Block vs inline text

In certain places, formatted text will be displayed inline. Inline text renders as a single line, hence newlines and horizontal rules are ignored, and lists are collapsed. Because text is rendered inline in field labels, LaTeX text might not appear as intended. In these cases, it is recommended to move the LaTeX expression to the description.

Use cases

Here are some examples of how you can apply formatted text:

  • Add an equation to a parametrization field description tooltip:

  • Add a subscript to a parametrization field label:

  • Refine an editor with clarifying, formatted text and formulae:

  • Add a unit suffix with LaTeX to a parametrization field label:

  • Add a heading and a list to MapPoint description:

  • Format the welcome message in the dashboard:

Supported Markdown syntax

All of CommonMark Markdown is supported except for images, which are ignored.

Using HTML tags in Markdown-formatted text is not supported, all HTML tags are automatically stripped for security reasons. Markdown links will always open in a new tab.

Rendering math symbols with LaTeX

Rendering math symbols is supported using LaTeX syntax. See KaTeX Supported functions or KaTeX Support Table for all supported LaTeX functions.

To render LaTeX inline, wrap a LaTeX expression in dollar signs. For example:

$x=\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$

To render LaTeX as a block, wrap a LaTeX expression in double dollar signs and a newline:

$$
L = \frac{1}{2} \rho v^2 S C_L
$$

Block LaTeX text is centered by default.

note

A nifty webapp to find the right LaTeX symbol by drawing is Detexify: LaTeX handwritten symbol recognition

Escape strings in Python

While writing LaTeX you may encounter the following warning in the command-line shell:

DeprecationWarning: invalid escape sequence \p

When certain characters (for example \u, \f, \b, \r, \v, \x) are preceded by a backslash they are viewed as 'escape sequences' by Python. To resolve this deprecation warning simply add another backslash in front of the LaTeX function to make the warning go away, for example $\\xi = \\gamma \\times \\epsilon^3$.

My LaTeX equation is showing as plain text, what's wrong?

  1. Check if your LaTeX expression is wrapped in dollar signs $
  2. If it is colored red, the math expression is not valid KaTeX. Check your LaTeX functions and check if they are supported by KaTeX. Try entering it in online KaTeX editor and see if it renders ok in there.
  3. Check if there's an invalid escape sequence in your LaTeX expression

Line breaks

In block (non-inline) formatted text, line breaks can be defined in two ways: using the newline control character \n or using multiline strings.

1. Using the newline control character

Use \\\n or \n preceded by two spaces to add a newline to a regular string.

description="This description  \n is multiline"
description="This description \\\n is multiline"

will both result in

single newline

2. Using multiline strings

Multiline strings are strings that are wrapped in three quotes (single or double): """a multiline string""" or '''a multiline string'''.

To add a newline in between lines, just add an empty line in between.

description="""This description

is

multiline"""

multi newline

To make a single newline in a multiline string, add \\ to the end of a line.

description="""This description \\
is multiline"""

single newline

Using the newline control character with three backslashes or preceded by two spaces will also make a linebreak in multiline strings.

description="""This description \\\n is multiline"""
description="""This description  \n is multiline"""

will also result in

single newline

caution

Do not include indentation in multiline strings. Be sure to remove indentation at the start of each line, any line with indentation in a multiline string is ignored. If you want to add indentation to a line you can do so by making it a blockquote by prefixing it with >. Alternately, you can add the special character   at the start of line to add a space.

description="""Line 1

> Indented blockquote line
   2 spaces indented line
Space indented lines will be ignored

Line 3"""