2016-05-03 02:28:06 +00:00
caption: Code Blocks
2013-12-05 16:21:10 +00:00
created: 20131205160047557
2016-05-03 02:28:06 +00:00
modified: 20160606140326254
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
<pre>
```
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:
<pre>
This is an ordinary paragraph
```
This will be monospaced
```
</pre>
The correct version is:
<pre>
This is an ordinary paragraph
```
This will be monospaced
```
</pre>
2016-05-03 02:28:06 +00:00
Note that some keyboard layouts treat the backtick as a [[dead key|http://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