Template:Codebox
| {{{1}}} |
|---|
| {{{2}}} |
Contents |
[edit] Usage, Limitations, and Options
[edit] Usage
This is a simple text panel. It has a text heading and a text body. The background is white and the font is fixed. It is intended for short code sections in pages. The width can be set. The alignment is right, left, and center.
An example of its use, and the result is shown below:
{{codebox|width=33%|align=center|Heading|This is the text body. It has no frills and in my view might be good for listing code. The problem of preformatted text is mentioned below, with the solution to it. Expressing the solution in type is a problem all of its own!}}
| Heading |
|---|
| This is the text body. It has no frills and in my view might be good for listing code. The problem of preformatted text is mentioned below, with the solution to it. Expressing the solution in type is a problem all of its own! |
[edit] Limitations
It needs tags for (pre)formatted text, with possible consideration of literals for any such tags in the code block itself.
[edit] Options
- width
- box width px pt % (default 340px)
- align
- box position on the page, left, right, or center (default center)
Parameters are 1 and 2 for heading and body text
[edit] Formatting Problems with 'pre'
When a code block is enclosed with the terms <pre></pre> to produce a page of preformatted code, the pre tags within the code block itself cause mixups with the outer tags. Replace the code block's <pre></pre> tags with the literals:
<pre> and </pre>
The resultant code block will show <pre></pre> in their place, and the mixups will be avoided. This method extends to other similar cases.