Help:Formatting
From Unify Community Wiki
(Difference between revisions)
(Fixed syntax highlighting tag) |
Isaiah Kelly (Talk | contribs) (Improved and updated instructions) |
||
Line 1: | Line 1: | ||
− | ==General Guidelines== | + | == General Guidelines == |
− | * Please | + | |
− | * | + | * Please check for spelling, punctuation and grammatical errors in your work before submitting it. All text should also be in English. |
− | + | * Discussions and comments about a page belong in the accompanying discussion page. You can visit or create the discussion section of any page by clicking on the "Discussion" tab at the top left corner. | |
− | * | + | * Place relevant [http://meta.wikimedia.org/wiki/Help:Category category] tags at the bottom of the page. Please try to use them logically and look at existing pages for use examples. |
+ | * Look to existing pages for ideas on how to format new pages and keep content consistent but also feel free to improve upon existing formats where it makes sense. | ||
* Don't use tabs in code examples. They are hard to type when editing in a browser and lines containing tabs have weird problems when combined with links generated by the syntax highlighter. If you have a script file with tabs and don't want to change that, you can copy the contents and then run the following line in a command shell before pasting it into the wiki: '' pbpaste | expand -t 4 | pbcopy '' (This example assumes you have set your editor to have a tab stop every 4 characters). | * Don't use tabs in code examples. They are hard to type when editing in a browser and lines containing tabs have weird problems when combined with links generated by the syntax highlighter. If you have a script file with tabs and don't want to change that, you can copy the contents and then run the following line in a command shell before pasting it into the wiki: '' pbpaste | expand -t 4 | pbcopy '' (This example assumes you have set your editor to have a tab stop every 4 characters). | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
[[Help:Contents| More editing help.]] | [[Help:Contents| More editing help.]] | ||
− | == | + | == Sample Code == |
− | + | ||
− | < | + | Small snippets of code, like for example <code> int health = 100</code>, can be denoted using the simple <code><code></code></code> tag but for full blocks of code and proper syntax highlighting you should use <code><syntaxhighlight lang="csharp"></syntaxhighlight></code> instead. Which will produce the following formatting: |
− | + | <syntaxhighlight lang="csharp"> | |
+ | using UnityEngine; | ||
− | + | public class MyScript : MonoBehaviour | |
− | public class | + | |
{ | { | ||
− | public | + | public int value = 943; |
− | + | ||
− | + | ||
− | + | // Update is called once per frame. | |
+ | private void Update() | ||
{ | { | ||
− | + | if (value > 0) | |
− | + | { | |
− | + | value--; | |
− | + | } | |
− | + | ||
− | + | ||
} | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | The <code><syntaxhighlight lang=""></code> tag also supports other programming languages like boo and javascript but the latest versions of Unity now only support C#. So using any language besides C# in the wiki is no longer recommended. | |
− | + | ||
− | + | ||
− | + | ||
− | The | + | |
− | + | ||
− | < | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + |
Revision as of 22:14, 23 February 2019
General Guidelines
- Please check for spelling, punctuation and grammatical errors in your work before submitting it. All text should also be in English.
- Discussions and comments about a page belong in the accompanying discussion page. You can visit or create the discussion section of any page by clicking on the "Discussion" tab at the top left corner.
- Place relevant category tags at the bottom of the page. Please try to use them logically and look at existing pages for use examples.
- Look to existing pages for ideas on how to format new pages and keep content consistent but also feel free to improve upon existing formats where it makes sense.
- Don't use tabs in code examples. They are hard to type when editing in a browser and lines containing tabs have weird problems when combined with links generated by the syntax highlighter. If you have a script file with tabs and don't want to change that, you can copy the contents and then run the following line in a command shell before pasting it into the wiki: pbpaste | expand -t 4 | pbcopy (This example assumes you have set your editor to have a tab stop every 4 characters).
Sample Code
Small snippets of code, like for example int health = 100
, can be denoted using the simple <code></code>
tag but for full blocks of code and proper syntax highlighting you should use <syntaxhighlight lang="csharp"></syntaxhighlight>
instead. Which will produce the following formatting:
using UnityEngine; public class MyScript : MonoBehaviour { public int value = 943; // Update is called once per frame. private void Update() { if (value > 0) { value--; } } }
The <syntaxhighlight lang="">
tag also supports other programming languages like boo and javascript but the latest versions of Unity now only support C#. So using any language besides C# in the wiki is no longer recommended.