Template:Code: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(darken code border) |
||
Line 1: | Line 1: | ||
<span style="background-color: #FFFFFF; |
<span style="background-color: #FFFFFF; |
||
border: 1px dotted # |
border: 1px dotted #e0e0e0; |
||
font-family: monospace, 'Courier New'; |
font-family: monospace, 'Courier New'; |
||
font-size: 105%;">{{{1}}}</span><noinclude> |
font-size: 105%;">{{{1}}}</span><noinclude> |
Revision as of 07:56, 10 August 2013
{{{1}}}
Usage
Good for short code segments:
- {{Code|code line}}
Not so good for longer segments:
- This is a long line of code that may have many words that continue for a long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long length.
Used to highlight code samples in an enlarged (through the site's main.css), monospace typeface that is easier to read than the default.
The template form is shorter and easier to enter while editing.
- Instead, see the technique below:
For code blocks
<nowiki> Start with a space in the first column, (before the <nowiki>). Then your block format will be maintained. This is good for copying in code blocks: def function(): """documentation string""" if True: print True else: print False</nowiki>
Working Example (click edit to see wikicode)
def function(): """documentation string""" if True: print True else: print False