1 |
efrain |
1 |
---
|
|
|
2 |
layout: docs
|
|
|
3 |
title: Code
|
|
|
4 |
description: Documentation and examples for displaying inline and multiline blocks of code with Bootstrap.
|
|
|
5 |
group: content
|
|
|
6 |
toc: true
|
|
|
7 |
---
|
|
|
8 |
|
|
|
9 |
## Inline code
|
|
|
10 |
|
|
|
11 |
Wrap inline snippets of code with `<code>`. Be sure to escape HTML angle brackets.
|
|
|
12 |
|
|
|
13 |
{{< example >}}
|
|
|
14 |
For example, <code><section></code> should be wrapped as inline.
|
|
|
15 |
{{< /example >}}
|
|
|
16 |
|
|
|
17 |
## Code blocks
|
|
|
18 |
|
|
|
19 |
Use `<pre>`s for multiple lines of code. Once again, be sure to escape any angle brackets in the code for proper rendering. You may optionally add the `.pre-scrollable` class, which will set a max-height of 340px and provide a y-axis scrollbar.
|
|
|
20 |
|
|
|
21 |
{{< example >}}
|
|
|
22 |
<pre><code><p>Sample text here...</p>
|
|
|
23 |
<p>And another line of sample text here...</p>
|
|
|
24 |
</code></pre>
|
|
|
25 |
{{< /example >}}
|
|
|
26 |
|
|
|
27 |
## Variables
|
|
|
28 |
|
|
|
29 |
For indicating variables use the `<var>` tag.
|
|
|
30 |
|
|
|
31 |
{{< example >}}
|
|
|
32 |
<var>y</var> = <var>m</var><var>x</var> + <var>b</var>
|
|
|
33 |
{{< /example >}}
|
|
|
34 |
|
|
|
35 |
## User input
|
|
|
36 |
|
|
|
37 |
Use the `<kbd>` to indicate input that is typically entered via keyboard.
|
|
|
38 |
|
|
|
39 |
{{< example >}}
|
|
|
40 |
To switch directories, type <kbd>cd</kbd> followed by the name of the directory.<br>
|
|
|
41 |
To edit settings, press <kbd><kbd>ctrl</kbd> + <kbd>,</kbd></kbd>
|
|
|
42 |
{{< /example >}}
|
|
|
43 |
|
|
|
44 |
## Sample output
|
|
|
45 |
|
|
|
46 |
For indicating sample output from a program use the `<samp>` tag.
|
|
|
47 |
|
|
|
48 |
{{< example >}}
|
|
|
49 |
<samp>This text is meant to be treated as sample output from a computer program.</samp>
|
|
|
50 |
{{< /example >}}
|