In custom quizzes, you can format text as code by using the in-line Markdown formatting tags. This also works when leaving feedback or comments for students in the conversation tab. (Note: Markdown isn't supported in custom exercises/activities, only custom quiz assignments)
See below for a list of these common formatting options:
Code and Syntax Highlighting
Inline code:
To apply formatting inline, you can wrap text in backticks `
Example input:
`takeBall()`
Code output:
takeBall()
Blocks of code:
If you would like to apply formatting for code blocks, you can use three backticks and indicate the language for syntax highlighting.
JavaScript:
Example input:
```javascript
var s = "JavaScript syntax highlighting";
alert(s);
```
Code output:
Python:
Example input:
```python
s = "Python syntax highlighting"
print s
```
Code output:
No Language Specified:
Note--if you do not specify the language, no syntax highlighting will appear.
Example input:
```
No language indicated, so no syntax highlighting.
```
Code output:
No language indicated, so no syntax highlighting.
Headers
Example input:
# H1 example text
## H2 example text
### H3 example text
#### H4 example text
##### H5 example text
###### H6 example text
Alternate H1/H2 Header with Horizontal Rule
Example input:
Alt-H1
======
Alt-H2
------
Code output:
Links
Example input:
[Clickable text for inline-style link](https://www.codehs.com)
[Clickable text for link with a title](https://www.codehs.com "CodeHS Homepage")
Code output:
Images
Example input:
![alt text](https://static.codehs.com/img/program_icons/karel.png "CodeHS Logo")
Code output:
Emphasis
How to use emphasis:
Italics: wrap text in *asterisks* or _underscores_
Bold: wrap text in double **asterisks** or __underscores__
Combined: wrap with: **asterisks and __underscores__**
Strikethrough: wrap text in two tildes: ~~example text~~
More info on Using Markdown: Markdown Guide
Still have questions? Contact our team at hello@codehs.com to learn more!