Documentation

Formatting 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:

Formating Your Survey Text With Markdown

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:

Formating Your Survey Text With Markdown

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:

Formating Your Survey Text With Markdown

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

Formating Your Survey Text With Markdown

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

Formating Your Survey Text With Markdown

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

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

Formating Your Survey Text With Markdown

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

Formating Your Survey Text With Markdown

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

Formating Your Survey Text With Markdown

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

Formating Your Survey Text With Markdown

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

Formating Your Survey Text With Markdown

Footnotes

Formating Your Survey Text With Markdown

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