@ -481,12 +481,24 @@ of a code block are interpreted literally. Markdown wraps a code block
in both `<pre>` and `<code>` tags.
in both `<pre>` and `<code>` tags.
To produce a code block in Markdown, simply indent every line of the
To produce a code block in Markdown, simply indent every line of the
block by at least 4 spaces or 1 tab. For example, given this input:
block by at least 4 spaces or 1 tab. Alternatively precede the block with
a line consisting of 3 backtick quotes (or more) and follow it with a
line consisting of the same number of backtick quotes -- in this case the
code lines themselves do not require any additional indentation.
For example, given this input:
This is a normal paragraph:
This is a normal paragraph:
This is a code block.
This is a code block.
Or this equivalent input:
This is a normal paragraph.
```
This is a code block.
```
Markdown will generate:
Markdown will generate:
<p>This is a normal paragraph:</p>
<p>This is a normal paragraph:</p>
@ -494,8 +506,11 @@ Markdown will generate:
<pre><code>This is a code block.
<pre><code>This is a code block.
</code></pre>
</code></pre>
One level of indentation -- 4 spaces or 1 tab -- is removed from each
Note that when using the 3 backtick quotes technique, the blank line
line of the code block. For example, this:
before the start of the code block is optional. One level of
indentation -- 4 spaces or 1 tab -- is removed from each
line of the code block unless the 3 backtick quotes are used.
For example, this:
Here is an example of AppleScript:
Here is an example of AppleScript:
@ -513,7 +528,13 @@ will turn into:
</code></pre>
</code></pre>
A code block continues until it reaches a line that is not indented
A code block continues until it reaches a line that is not indented
(or the end of the article).
(or the end of the article) when using the indentation technique or
until a line consisting of the same number of backtick quotes is found
when using the 3 backtick quotes technique.
Note that the 3 backtick quotes (or more) must appear at the beginning
of the line. To include a code block within a list (or other indented
element), the indentation technique must be used.
Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
are automatically converted into HTML entities. This makes it very
are automatically converted into HTML entities. This makes it very