Documentation

Formating your survey text with markdown

Article

Formating your survey text with markdown

You can incorporate markdown into your survey questions and options text to provide formatting, such as headers, bold, and italicized content.

Line breaks

You can add newlines to questions using the code \n\n in a single-line question, or by putting two line breaks in if you're using multi-line question code.

Example question source:
s.text_questions("This is the first line.\n This is still the same paragraph.\n\n This is a new paragraph.")

is the same as

s.text_questions(
"""This is the first line.
This is still the same paragraph.

This is a new paragraph.""")
Rendered output:

This is the first line.

This is still the same paragraph.

This is a new paragraph.

Headers

You can insert headers as follows:

s.text_questions(
"""# Header 1
# Header 2
# Header 3
# Header 4
# Header 5
# Header 6"""

These displays list this:

cea4190c 0573 4f38 85ed c95ef1917e9a

Lists
s.text_questions(
"""### Unordered List
- Item 1
  - Subitem 1.1
  - Subitem 1.2
- Item 2
- Item 3

# Ordered List
1. First item
2. Second item
   1. Subitem 2.1
   2. Subitem 2.2
3. Third item
""")

These display like this:

86aae809 7241 4a0a 9fce 83d141bb3c57

Emphasis
s.text_questions(
"""- *Italic text*  
- _Italic text_  
- **Bold text**  
- __Bold text__  
- ***Bold and italic text***  
- ___Bold and italic text___  
- ~~Strikethrough~~
"""

These display like this:

4b768802 3703 4b5c bfbf 15af28de29f3

Images
s.text_questions(
"""![Markdown Logo](/images/logos/formating-your-survey-text-with-markdown-markdown-logo.svg)
""")

a15d60fd 000d 4a5a b867 090cbb619b28

Links
s.text_questions("[Markdown Guide](https://www.markdownguide.org)")

5d670b0b 3426 48ba 97d9 b3fefbb88707

Code
s.text_questions(
"""### Inline Code
Use `code()` to include inline code.

# Code Block
```python
def hello_world():
    print("Hello, World!")
```""")

bd00455d 6b66 4be2 8e19 84078feabe38

Tables
s.text_questions(
"""| Column 1 | Column 2 | Column 3 |
|----------|----------|----------|
| Row 1    | Data     | Value    |
| Row 2    | Example  | Test     |""")

fcdff0bf 79f0 47b1 9a80 d64483103089

Horizontal Rule
s.text_questions("---")

4c956f17 e884 4688 a774 eff55528be01

Task Lists
s.text_questions(
"""
- [x] Completed Task
- [ ] Incomplete Task
""")

1abe9a35 9a85 4c0c 9f4d f3e131649f4f

Escaping special characters
s.text_questions(
"""
Use a backslash to escape characters:  
\*This text is not italicized\*
""")

0ce984e2 685b 4a1c 9fe0 e08e5a194fce

Footnotes

3f33ea07 ac11 4cf8 91e4 9c0e1770a561

s.text_questions(
"""
This is an example of a footnote.[^1]

[^1]: Footnote explanation.
""")
Unsupported features

We do not support:

  • Block quotes
  • Emojis
  • Embedded HTML