Code blocks
A fence of three or more backticks (or tildes), the language after it, and optionally a name:
```bash title="backup.sh"
rsync -a ~/Tisty/ /Volumes/Backup/Tisty/
```rsync -a ~/Tisty/ /Volumes/Backup/Tisty/
Each language is coloured its own way:
```python title="walks.py"
def kilometres(walks):
# Add up what was walked this month
return sum(w["km"] for w in walks if w["done"])
```def kilometres(walks):
# Add up what was walked this month
return sum(w["km"] for w in walks if w["done"])
```javascript
const vaccines = ["rabies", "eight-in-one"];
for (const one of vaccines) console.log(`Due: ${one}`);
```const vaccines = ["rabies", "eight-in-one"];
for (const one of vaccines) console.log(`Due: ${one}`);
```json title="rina.json"
{ "name": "Rina", "age": 4, "vaccines": ["rabies"], "chip": true }
```{ "name": "Rina", "age": 4, "vaccines": ["rabies"], "chip": true }
```sql
SELECT name, date FROM vaccines WHERE pet = 'Rina' ORDER BY date DESC;
```SELECT name, date FROM vaccines WHERE pet = 'Rina' ORDER BY date DESC;
Inside a sentence, code goes between backticks:
Run `npm run guide` and open `target/guide`.Run npm run guide and open target/guide.
- The name goes in
title="…"; a"inside it is written\". Other readers ignore it. - Whatever else other tools write after the language, like
showLineNumbers, is kept as written; Tisty reads the language and the name. - To show a fence inside a block, use a longer fence around it.
- A block indented four spaces is code too.
- Nothing in code is a tag, a pen, an icon or an emoji.