Difference between revisions of "Help:Editing"

From ProgrammingExamples
Jump to: navigation, search
(mention pre tag)
Line 7: Line 7:
 
* To get syntax highlighting, surround your source code with <code><nowiki><source lang="</nowiki>''language''<nowiki>">...</source></nowiki></code> <br />or (preferred) <code><nowiki><syntaxhighlight lang="</nowiki>''language''<nowiki>">...</syntaxhighlight></nowiki></code>. <br />The [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages list of supported languages] is huge, and includes among many others '''c''', '''cpp''', '''java''', '''perl''', '''python'''. Note: lang attributes are in all lower case.
 
* To get syntax highlighting, surround your source code with <code><nowiki><source lang="</nowiki>''language''<nowiki>">...</source></nowiki></code> <br />or (preferred) <code><nowiki><syntaxhighlight lang="</nowiki>''language''<nowiki>">...</syntaxhighlight></nowiki></code>. <br />The [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages list of supported languages] is huge, and includes among many others '''c''', '''cpp''', '''java''', '''perl''', '''python'''. Note: lang attributes are in all lower case.
 
* To keep your indentation, but '''not''' show syntax highlighting, you may surround your code with ''pre'' tags: <br /><code><nowiki><pre>your code</pre></nowiki></code>
 
* To keep your indentation, but '''not''' show syntax highlighting, you may surround your code with ''pre'' tags: <br /><code><nowiki><pre>your code</pre></nowiki></code>
 
=== '''Do'''s and '''Don't'''s for using the Programming Examples Wiki ===
 
* '''Do'''
 
** Create a 'dispatch page' for each new language that you add, put links to examples in that language on that page.
 
** Try to keep each example as short as possible... and no shorter!
 
** Try to demonstrate a single concept per example.
 
** Comment, comment, comment!
 
* '''Don't'''
 
** Do not treat the wiki as your own personal code dump. Things that are placed here should be useful for many people.
 
** Do not "hijack" code someone else has submitted by changing what it does. (Do improve it if you see a way)
 

Revision as of 14:43, 28 June 2010

Editing Wiki Pages

Quick tricks

  • To get syntax highlighting, surround your source code with <source lang="language">...</source>
    or (preferred) <syntaxhighlight lang="language">...</syntaxhighlight>.
    The list of supported languages is huge, and includes among many others c, cpp, java, perl, python. Note: lang attributes are in all lower case.
  • To keep your indentation, but not show syntax highlighting, you may surround your code with pre tags:
    <pre>your code</pre>