Skip to main content

Format your survey text

The beginners guide to markdown

Updated over 2 weeks ago

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:

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:

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:

Images

s.text_questions(
"""![Markdown Logo](https://upload.wikimedia.org/wikipedia/commons/4/48/Markdown-mark.svg)
""")

Links

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

Code

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

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

Tables

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

Horizontal Rule

s.text_questions("---")

Task Lists

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

Escaping special characters

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

Footnotes

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

Did this answer your question?