Copyright (c) Hyperion Entertainment and contributors.

Help:Editing: Difference between revisions

From AmigaOS Documentation Wiki
Jump to navigation Jump to search
Content deleted Content added
Page creation
 
m Text replacement - "<syntaxhighlight>" to "<syntaxhighlight lang="C" line>"
 
Line 59: Line 59:


=== Syntax highlighting ===
=== Syntax highlighting ===
It's often required to quote source code. The common way of doing it is to use embraces the code between <nowiki><pre></pre></nowiki> but the drawback of such solution is that the code in not too easy to read. Instead you can use the <nowiki><syntaxhighlight></syntaxhighlight></nowiki> this will give readers syntax highlighting.
It's often required to quote source code. The common way of doing it is to use embraces the code between <nowiki><pre></pre></nowiki> but the drawback of such solution is that the code in not too easy to read. Instead you can use the <nowiki><syntaxhighlight lang="C" line></syntaxhighlight></nowiki> this will give readers syntax highlighting.


{| class="wikitable"
{| class="wikitable"
Line 92: Line 92:
! scope="row"| With
! scope="row"| With
|
|
<pre><syntaxhighlight>#include <stdio.h>
<pre><syntaxhighlight lang="C" line>#include <stdio.h>
int main()
int main()
{
{
Line 101: Line 101:
</syntaxhighlight></pre>
</syntaxhighlight></pre>
|
|
<syntaxhighlight>#include <stdio.h>
<syntaxhighlight lang="C" line>#include <stdio.h>
int main()
int main()
{
{

Latest revision as of 19:21, 26 January 2025

Rules

Category

Categories help users finding information more quickly by grouping together article related to the same subject. An article can be related to any number of categories. Adding an article to the category MyCategory is simple just add somewhere in the article (preferably at the beginning) the wiki code

[[Category:MyCategory]]

.

All categories associated with an article are displayed at the bottom of the article. Each category name is clickable and brings the user to a page listing every article related to this category in alphabetical order. A category page is a wiki page like any other so it's more effective to edit and fill it with useful text instead of letting it empty with just the article listing. See for example the page for the Category:Debug.

Formatting

Tables

To be useful and ensure consistency tables must follow the rules:

  • use table caption instead of separate formatted text. This is done by adding the wiki code |+ followed by the caption text.
  • activate table border and cell colors. This is done by adding the wiki code class="wikitable" on the same line as the table start.
  • use table headers instead of separate formatted text. This is done by using the wiki code !. In case of row headers it's possible to use the scope=row|col attribute to define the scope. For this includes the attribute after the ! but before the header text and separate it from the text by a |

Example:

Wiki code Preview
{| class="wikitable"
|+ Sample caption
|-
! scope="col"| Col header 1
! scope="col"| Col header 2
! scope="col"| Col header 3
|-
! scope="row"| Row header 1
| 1st cell row 1
| 2nd cell row 1
|-
! scope="row"| Row header 2
| 1st cell row 2
| 2nd cell row 2
|-
! scope="row" colspan="2"| Row header 3 with colspan
| 1st cell row 3
|}
Sample caption
Col header 1 Col header 2 Col header 3
Row header 1 1st cell row 1 2nd cell row 1
Row header 2 1st cell row 2 2nd cell row 2
Row header 3 with colspan 1st cell row 3

Syntax highlighting

It's often required to quote source code. The common way of doing it is to use embraces the code between <pre></pre> but the drawback of such solution is that the code in not too easy to read. Instead you can use the <syntaxhighlight lang="C" line></syntaxhighlight> this will give readers syntax highlighting.

Code sample with and without syntax highlighting
Method Wiki code Preview
Without
<pre>
#include <stdio.h>
int main()
{
    printf("just hello");
 
    return 0;
}
</pre>
#include <stdio.h>
int main()
{
    printf("just hello");
 
    return 0;
}
With
<syntaxhighlight lang="C" line>#include <stdio.h>
int main()
{
    printf("just hello");
 
    return 0;
}
</syntaxhighlight>
#include <stdio.h>
int main()
{
    printf("just hello");
 
    return 0;
}

Additional Help

You can find useful interesting additional help on the official [Mediawiki] website, more specifically in the Mediawiki:Formatting help page