2016-05-03 02:28:06 +00:00
caption: Code Blocks
2013-12-05 16:21:10 +00:00
created: 20131205160047557
2022-05-14 12:31:36 +00:00
modified: 20220513120302826
2014-09-11 08:15:58 +00:00
tags: WikiText
2013-12-05 16:21:10 +00:00
title: Code Blocks in WikiText
type: text/vnd.tiddlywiki
2019-10-13 14:35:36 +00:00
You can use triple backticks <code>```</code> to mark code blocks (<<.icon $:/core/images/mono-block>>):
2013-12-05 16:21:10 +00:00
2022-05-14 12:31:36 +00:00
<pre>```
2013-12-05 16:21:10 +00:00
This will be monospaced
```
</pre>
Renders as:
```
This will be monospaced
```
2014-02-14 19:09:49 +00:00
2014-10-24 13:50:19 +00:00
To be interpreted correctly, the three backticks need to be at the start of the line and immediately followed by a line-break.
Be aware that any preceding paragraph content should be properly terminated with a double line break, too. So, this example is wrong:
2022-05-14 12:31:36 +00:00
<pre>This is an ordinary paragraph
2014-10-24 13:50:19 +00:00
```
This will be monospaced
```
</pre>
The correct version is:
2022-05-14 12:31:36 +00:00
<pre>This is an ordinary paragraph
2014-10-24 13:50:19 +00:00
```
This will be monospaced
```
</pre>
2020-05-06 08:40:42 +00:00
Note that some keyboard layouts treat the backtick as a [[dead key|https://en.wikipedia.org/wiki/Dead_key]], making it hard to type. The trick is to type three backticks followed by a space. Alternatively, type all six backticks in one go, then a space, and then move the cursor back three characters to type or paste the content.
2014-02-14 19:09:49 +00:00