Using backticks to highlight expressions

tutorial
programming
markdown

#1

When talking about Audulus, you’re bound to find yourself writing some mathematical expressions.

A nice way to make these expressions stand out of your posts’ text is to use the code comment feature.

This uses a set of backticks around your expression to change the font from sans-serif to fixed-width, and adds a little hightlight to the background.

Compare the readability of sin(x^2*10)/pi with sin(x^2*10)/pi. The code comment feature makes the formula pop a little more.

The backtick is the little single quote below the tilde ~ on your keyboard.

`x^2`

is

x^2

If you want to comment multiple lines, you can add four spaces before the text, like this:

•••• Line 1
•••• Line 2
•••• Line 3
•••• etc.

ProTip: Audulus Syntax

When commenting with expressions like this, try to use Audulus’ syntax so that people can easily copy and paste your formulas into their patches.

Audulus will not parse x(y). You must write x*y.

You also cannot have spaces between a variable. For example Volume Knob*x won’t parse, but VolumeKnob*x will.

You can however have spaces in between variables and operators like this

sin ( VolumeKnob ) * x

which is the same as

sin(VolumeKnob)*x

For expressing more complex math formulas, especially when doing a tutorial about a concept where you don’t intend the user to drop a formula into an Expression node, consider using MathJax syntax so you can create clear and beautifully formatted equations like this

\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}

#3

I haven’t tested all of this, as I am still new to Audulus and the forum, but I have found that all of the markdown that I use for GitHub (that I have tried so far) works. I figured this might be helpful to some others that aren’t used to markdown syntax, I turned this markdown cheatsheet page from GitHub into a pdf to share with anyone who might wanna use it here or somewhere else that it will be useful :slight_smile:
markdown-cheatsheet-online.pdf (1.8 MB)


#4

Cheat sheets are the best thing we weren’t supposed to learn how to use in school.