Help:Adding a new programming example: Difference between revisions
Content added Content deleted
(Updated example for new code-tags) |
m (→Navigation: Fixed up a bit, when will we get code highlighting working?) |
||
Line 13: | Line 13: | ||
In order to maintain the readability, searchability and browseability of Rosetta Code, we need you to follow certain formatting rules. Please ensure that your contributed code conforms to one of these [[Help:Programming Example Prototypes|programming example prototypes]]. A simple example should look something like this: |
In order to maintain the readability, searchability and browseability of Rosetta Code, we need you to follow certain formatting rules. Please ensure that your contributed code conforms to one of these [[Help:Programming Example Prototypes|programming example prototypes]]. A simple example should look something like this: |
||
<nowiki> |
<nowiki>=={{header|C}}== |
||
=={{header|C}}== |
|||
{{works with|gcc|4.0.1}} |
{{works with|gcc|4.0.1}} |
||
{{libheader|SDL}} |
{{libheader|SDL}} |
||
Optional text explaining stuff |
Optional text explaining stuff |
||
<code lang="C"> |
<code lang="C"> |
||
int main ( void ) { |
int main ( void ) { |
||
// Some code here |
// Some code here |
||
} |
} |
||
</code> |
</code></nowiki> |
||
</nowiki> |
|||
You don't have to use the C programming language, and your code example will probably be different. You need to make sure you create a link to your language of choice, and to your compiler, interpreter, or what-have-you using the "works with" template. You should also note any special [[libraries]] you use with the "libheader" template. |
You don't have to use the C programming language, and your code example will probably be different. You need to make sure you create a link to your language of choice, and to your compiler, interpreter, or what-have-you using the "works with" template. You should also note any special [[libraries]] you use with the "libheader" template. |
||
The |
The <nowiki><code></nowiki> tags enclose the actual example, and allow [[Help:Syntax_highlighting|syntax highlighting]], which includes proper formatting for white space. |
||
==Formatting== |
==Formatting== |