Python and Markdown cells
#
Python cellsUsers can edit and execute any valid Python in a Python cell.
Python cells can optionally have outputs, which are visualizations of elements from the code.
If any line of a Python cell explicitly prints a value (e.g: print("hello!")
), that value will be included in the Output along with any other values explicitly printed by other lines.
Lines that implicitly print a value (e.g: 2+2
) are only included in output if they occur on the last line of a Python cell.
If a cell has no explicit print statements and the last line does not print a value explicitly or implicitly (e.g: x = 5
), nothing is displayed as output. This is perfectly fine, and is often done to keep things readable while setting the stage for another cell that will display something.

#
Markdown cellsMarkdown cells allow you to easily create richly-formatted text.

Hex uses the CommonMark markdown renderer - if you need help getting started with markdown we recommend checking out their reference and tutorial.
#
Dynamic markdownYou can also insert Python variables directly into Markdown cells. Type your text as usual but in place of hard-coding the value you want, wrap the variable name in {{ }}
braces to dynamically update your Markdown text. See the screenshot below for an example.
#
Converting cellsYou can convert a cell from a Python to a Markdown cell and vice-versa using the dropdown in the upper right.
Or use keyboard shortcuts to convert between cell types:
- Go from Python to Markdown cells with
esc + m
- Go from Markdown to Python cells with
esc + y
