Media Wiki Editing: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=External= * WikiMedia Editing Reference Card: https://meta.wikimedia.org/wiki/Help:Reference_card =Internal= * Media Wiki =Overview= ==Links== Internal links: <pre...")
 
 
(158 intermediate revisions by the same user not shown)
Line 2: Line 2:


* WikiMedia Editing Reference Card: https://meta.wikimedia.org/wiki/Help:Reference_card
* WikiMedia Editing Reference Card: https://meta.wikimedia.org/wiki/Help:Reference_card
* WikiMedia Help: https://www.mediawiki.org/wiki/Help:Contents
* User's Guide https://meta.wikimedia.org/wiki/Help:Contents


=Internal=
=Internal=
Line 9: Line 11:
=Overview=
=Overview=


==Links==
=Links=


Internal links:
==Internal Links==
 
<syntaxhighlight lang='text'>
[[ThisIsALink]]
</syntaxhighlight>
 
Internal links that get a label:
 
<syntaxhighlight lang='text'>
[[ThisIsTheLink|This is the label that shows up in text]]
</syntaxhighlight>
 
==External Links==
 
External links that are rendered verbatim


<pre>
<pre>
  [[ThisIsALink]]
http://cnn.com
</pre>
</pre>


External links:
External links that get a label


<pre>
<pre>
http://cnn.com
[http://something.com/something/else Local Label]
</pre>
 
Note that "http:" can be omitted:
 
<pre>
[//something.com/something/else Local Label]
</pre>
</pre>


==Lists==
If you want to avoid a text with an external link syntax to be automatically turned into a link, use <nowiki><nowiki></nowiki>:
 
<nowiki><nowiki>http://cnn.com</nowiki></nowiki>
 
=Lists=


<pre>
<pre>
* List item
* List item
</pre>
</pre>
=Italics=
<pre>
''italics''
</pre>
=Bold=
<pre>
'''bold'''
</pre>
=Code and Fixed Typed Fonts=
==Code Section in a Box==
<pre>
&lt;pre&gt;...&lt;/pre&gt;
</pre>
==Indented Block==
The alternative is to indent the block:
This is
an indented
block
Note that when using this method, MediaWiki is sensitive to the presence of '&lt;source>' element. If you need to use it, use &lt immediately followed by ; to start the element.
However, this method is more flexible, as we can format the text:
This is
a block that contains <b>bold sections</b> and
<font color=red>RED sections</font>
End.
The size of the font in the indented block can be controlled with:
<font size='-1'>
In somewhat smaller font.
</font >
==In-Line Code==
The in-line code is marked using the &lt;code></code> HTML tag. It looks like this: <code>this is some code</code>. For more details, including how to change the rendering, see: {{Internal|Media Wiki Concepts#code_tag|Media Wiki Concepts &#124; &lt;code>}}
==In-Line no-formatting==
<nowiki><nowiki>...</nowiki></nowiki>
==Fixed Type Fonts==
<pre>
&lt;tt&gt; ... &lt;/tt&gt;
</pre>
==Alternative highlight for Code==
<font face='menlo' color='lightslategray' size='-1'>for i in "a b c"; do echo ${i}; done</font>
Use:
<syntaxhighlight lang='html'>
<font face='menlo' color='lightslategray' size='-1'>
</syntaxhighlight>
<code>for i in "a b c"; do echo ${i}; done</code>
=Paragraph Indentation=
<pre>
:One indent
::Two indents
:::Three indents
:::::: Multiple indent
</pre>
=Anchors and Linking to Anchors=
An anchor is a in-page link target - it allows incoming links to target locations on the page other than section headings.
The anchors are automatically generated in case of the section headings. For example, a section named "Section One" generates a Section_One anchor, and the heading can be linked to by prepending "#Section_One" to the usual wiki [[#Links]]. In case of multiple sections with identical headings, the anchor names have a "_2", "_3", etc appended starting from the second occurrence.
Manual anchors can be also inserted and used in links:
<pre>
<span id="anchor_name">text to anchor to</span>
</pre>
or
<pre>
<span id="anchor_name"></span>
</pre>
Do not use:
<pre>
<span id="anchor_name"/>
</pre>
it won't work.
==Anchor Names==
{|
| '''Heading Name''' || '''Anchor'''
|-
|Test || #Test
|-
|Section One || #Section_One
|-
|Capitalization does Matter || Capitalization_does_Matter
|}
==Special Anchors==
<nowiki>#toc</nowiki> links to the table of contents.
==Preserving Old Anchors when a Heading Changes==
If you want to change a heading to a more appropriate name, but want keep all existing links working, use the old anchor in a span ''inside'' the new heading, as follows:
<pre>
=<span id='Old_Heading'></span>New Heading=
</pre>
==More Details on Anchors==
https://meta.wikimedia.org/wiki/Help:Link#Anchors
=Tables=
{{External|https://www.mediawiki.org/wiki/Help:Tables}}
<pre>
{|
| topleft || topmiddle || topright
|-
| middleleft || middlemiddle || middleright
|-
| bottomleft || bottommiddle || bottomright
|}
</pre>
<pre>
{|
| . || . || . || . || .
|-
|  . || . || . || . || .
|-
| . || . || . || . || .
|}
</pre>
==Headers==
<syntaxhighlight lang='text'>
{|
! Header1
! Header2
! Header3
|-
| ...
</syntaxhighlight>
A specific style to a header can be specified with:
<syntaxhighlight lang='text'>
{|
! style="text-align:left;"| Header1
...
</syntaxhighlight>
==Borders==
<pre>
{| class="wikitable" style="text-align: left;"
! Header1
! Header2
! Header3
|-
| . || . ||
|-
|}
</pre>
==List in a Table Cell==
<pre>
{| class="wikitable" style="text-align: left;"
| The next cell contains a list ||
* a
* b
* c
|-
|}
</pre>
{| class="wikitable" style="text-align: left;"
| The next cell contains a list ||
* a
* b
* c
|-
|}
Without bullets:
<pre>
{| class="wikitable" style="text-align: left;"
| The next cell contains a list ||
line 1<br>
line 2<br>
line 3
|-
|}
</pre>
=Blockquote=
* Web colors reference: https://en.wikipedia.org/wiki/Web_colors
==Internal Link==
Use this as a border for in-wiki links
<pre>
<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;">
:[[SomeLink]]
</blockquote>
</pre>
<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;">
:[[SomeLink]]
</blockquote>
====Internal Link Template====
Alternatively, use this parameterized template: [[Template:Internal]]. The first parameter is the target wiki page name, optionally followed by # an the anchor. The second parameter is the name of the link, as it will be rendered in the page.
Example: <nowiki>{{Internal|WildFly Concepts|Concepts}}</nowiki>
==External Link==
Use this as a border for an external link (on blueish background).
<pre>
<blockquote style="background-color: AliceBlue; border: solid thin LightSteelBlue;">
:some_external_link<br>
</blockquote>
</pre>
<blockquote style="background-color: AliceBlue; border: solid thin LightSteelBlue;">
:http://example.com<br>
</blockquote>
====External Link Template====
Alternatively, use this parameterized templates: [[Template:External]] and [[Template:External2]].
For External, the first and only parameter is the external link, or text and link:
<nowiki>{{External|http://example.com}}</nowiki>
<nowiki>{{External|something, something else: http://example.com}}</nowiki>
External2 allows for two stacked links.
If the link is to be hidden and exposed as a label:
<nowiki>{{ExternalLabel|http://example.com|example}}</nowiki>
==Important Note or Observation, Warning==
Use this as a border for important notes and observations on gold background.
<pre>
<blockquote style="background-color: Gold; border: solid thin Goldenrod;">
:<br>Some content on gold<br><br>
</blockquote>
</pre>
<blockquote style="background-color: Gold; border: solid thin Goldenrod;">
:<br>Some content on gold<br><br>
</blockquote>
====Important Note, Observation, Warning Template====
Alternatively, use this parameterized template: [[Template:Warn]]. The first and only parameter is the warning text.
Example: <nowiki>{{Warn|something to warn about}}</nowiki>
==Error==
<pre>
<blockquote style="background-color: Tomato; border: solid thin red;">
:<br>Some content on red<br><br>
</blockquote>
</pre>
<blockquote style="background-color: Tomato; border: solid thin red;">
:<br>Some content on red<br><br>
</blockquote>
====Error Template====
Alternatively, use this parameterized template: [[Template:Error]]. The first and only parameter is the warning text.
Example: <nowiki>{{Error|some error}}</nowiki>
=Images and Media=
* External: https://www.mediawiki.org/wiki/Help:Images
==Default==
<pre>
[[Image:somefile.png]]
</pre>
==Framed Full Size==
<syntaxhighlight lang='wikimedia'>
[[Image:somefile.png|left|frame|caption]]
[[Image:somefile.png|center|frame|caption]]
</syntaxhighlight>
==Image at a Certain Size==
<syntaxhighlight lang='wikimedia'>
[[Image:somefile.png|200px]]
</syntaxhighlight>
==Thumbnail==
<pre>
[[Image:somefile.png|thumb|center]]
</pre>
==Others==
Text floating behind and at the right of the image
<pre>
[[Image:somefile.png|left|300px|caption]]
</pre>
{{External|[https://www.fidelity.com/learning-center/investment-products/options/introduction-to-options-video Fidelity Options Class] [[File:Options_3jd.png|left|100px]]}}
<br>
<br>
<br>
<br>
==To Export Wiki-Ready PNG==
<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;">
:[[OpenOffice#Export_Wiki-Ready_PNG|Export Wiki-Ready PNG in OpenOffice]]
</blockquote>
==PDF==
<pre>
[[Media:filename.pdf|PDF]]
</pre>
<pre>
[[File:filename.pdf|PDF]]
</pre>
There are cases when the above syntax does not result in a link to "PDF". This seems to fix it - note leading colon:
<pre>
[[:File:filename.pdf|PDF]]
</pre>
==Video==
<pre>
[[Media:video.asf|Video]]
</pre>
=Table of Contents=
* External https://www.mediawiki.org/wiki/Manual:Table_of_contents
By default shows up after three headers. If you want to force, use:
<pre>
__FORCETOC__
</pre>
=Templates=
See: {{Internal|Media Wiki Concepts#Templates|Media Wiki Concepts - Templates}}
=Syntax Highlighting=
<pre>
<syntaxhighlight lang="bash" line='line'>
...
</syntaxhighlight>
</pre>
<syntaxhighlight lang="bash" line='line'>
function test() {
  echo "this is a function"
}
</syntaxhighlight>
where lang can be:
* bash
* java
* xml
If the font size is too big, it can be corrected by putting the following CSS code fragment in MediaWiki:Common.css page. The page can be edited on-line at: https://kb.novaordis.com/index.php/MediaWiki:Common.css
<syntaxhighlight lang='css'>
/* CSS placed here will be applied to all skins */
.mw-highlight pre {
font-size: 90%;
}
</syntaxhighlight>
=Math=
{{External|https://en.wikipedia.org/wiki/Help:Displaying_a_formula}}
<math>1 + m + m^2 + m^3 + ... + m^{n-1} =  \dfrac{m^n-1}{m - 1}</math>

Latest revision as of 20:16, 24 July 2024

External

Internal

Overview

Links

Internal Links

[[ThisIsALink]]

Internal links that get a label:

[[ThisIsTheLink|This is the label that shows up in text]]

External Links

External links that are rendered verbatim

http://cnn.com

External links that get a label

[http://something.com/something/else Local Label]

Note that "http:" can be omitted:

[//something.com/something/else Local Label]

If you want to avoid a text with an external link syntax to be automatically turned into a link, use <nowiki>:

<nowiki>http://cnn.com</nowiki>

Lists

* List item

Italics

''italics''

Bold

'''bold'''

Code and Fixed Typed Fonts

Code Section in a Box


 <pre>...</pre>

Indented Block

The alternative is to indent the block:

This is
an indented
block

Note that when using this method, MediaWiki is sensitive to the presence of '<source>' element. If you need to use it, use &lt immediately followed by ; to start the element.

However, this method is more flexible, as we can format the text:

This is
a block that contains bold sections and 
RED sections
End.

The size of the font in the indented block can be controlled with:

In somewhat smaller font.

In-Line Code

The in-line code is marked using the <code> HTML tag. It looks like this: this is some code. For more details, including how to change the rendering, see:

Media Wiki Concepts | <code>

In-Line no-formatting

<nowiki>...</nowiki>

Fixed Type Fonts

<tt> ... </tt>

Alternative highlight for Code

for i in "a b c"; do echo ${i}; done Use:

<font face='menlo' color='lightslategray' size='-1'>

for i in "a b c"; do echo ${i}; done

Paragraph Indentation


:One indent
::Two indents
:::Three indents
:::::: Multiple indent

Anchors and Linking to Anchors

An anchor is a in-page link target - it allows incoming links to target locations on the page other than section headings.

The anchors are automatically generated in case of the section headings. For example, a section named "Section One" generates a Section_One anchor, and the heading can be linked to by prepending "#Section_One" to the usual wiki #Links. In case of multiple sections with identical headings, the anchor names have a "_2", "_3", etc appended starting from the second occurrence.

Manual anchors can be also inserted and used in links:

<span id="anchor_name">text to anchor to</span>

or

<span id="anchor_name"></span>

Do not use:

<span id="anchor_name"/>

it won't work.

Anchor Names

Heading Name Anchor
Test #Test
Section One #Section_One
Capitalization does Matter Capitalization_does_Matter

Special Anchors

#toc links to the table of contents.

Preserving Old Anchors when a Heading Changes

If you want to change a heading to a more appropriate name, but want keep all existing links working, use the old anchor in a span inside the new heading, as follows:

=<span id='Old_Heading'></span>New Heading=

More Details on Anchors

https://meta.wikimedia.org/wiki/Help:Link#Anchors

Tables

https://www.mediawiki.org/wiki/Help:Tables

{|
| topleft || topmiddle || topright
|-
| middleleft || middlemiddle || middleright
|-
| bottomleft || bottommiddle || bottomright
|}

{|
| . || . || . || . || .
|-
|  . || . || . || . || .
|-
| . || . || . || . || .
|}

Headers

{|
! Header1
! Header2
! Header3
|-
| ...

A specific style to a header can be specified with:

{|
! style="text-align:left;"| Header1
...

Borders

{| class="wikitable" style="text-align: left;"
! Header1
! Header2
! Header3
|-
| . || . ||
|-
|}

List in a Table Cell

{| class="wikitable" style="text-align: left;"
| The next cell contains a list || 
* a
* b
* c
|-
|}
The next cell contains a list
  • a
  • b
  • c

Without bullets:

{| class="wikitable" style="text-align: left;"
| The next cell contains a list || 
line 1<br>
line 2<br>
line 3
|-
|}

Blockquote

Internal Link

Use this as a border for in-wiki links

<blockquote style="background-color: #f9f9f9; border: solid thin lightgrey;">
:[[SomeLink]]
</blockquote>
SomeLink

Internal Link Template

Alternatively, use this parameterized template: Template:Internal. The first parameter is the target wiki page name, optionally followed by # an the anchor. The second parameter is the name of the link, as it will be rendered in the page.

Example: {{Internal|WildFly Concepts|Concepts}}

External Link

Use this as a border for an external link (on blueish background).

<blockquote style="background-color: AliceBlue; border: solid thin LightSteelBlue;">
:some_external_link<br>
</blockquote>
http://example.com

External Link Template

Alternatively, use this parameterized templates: Template:External and Template:External2.

For External, the first and only parameter is the external link, or text and link:

{{External|http://example.com}}

{{External|something, something else: http://example.com}}

External2 allows for two stacked links.

If the link is to be hidden and exposed as a label:

{{ExternalLabel|http://example.com|example}}

Important Note or Observation, Warning

Use this as a border for important notes and observations on gold background.

<blockquote style="background-color: Gold; border: solid thin Goldenrod;">
:<br>Some content on gold<br><br>
</blockquote>

Some content on gold

Important Note, Observation, Warning Template

Alternatively, use this parameterized template: Template:Warn. The first and only parameter is the warning text.

Example: {{Warn|something to warn about}}

Error

<blockquote style="background-color: Tomato; border: solid thin red;">
:<br>Some content on red<br><br>
</blockquote>

Some content on red

Error Template

Alternatively, use this parameterized template: Template:Error. The first and only parameter is the warning text.

Example: {{Error|some error}}

Images and Media

Default

[[Image:somefile.png]]

Framed Full Size

[[Image:somefile.png|left|frame|caption]]
[[Image:somefile.png|center|frame|caption]]

Image at a Certain Size

[[Image:somefile.png|200px]]

Thumbnail

[[Image:somefile.png|thumb|center]]

Others

Text floating behind and at the right of the image

[[Image:somefile.png|left|300px|caption]]
Fidelity Options Class
Options 3jd.png





To Export Wiki-Ready PNG

Export Wiki-Ready PNG in OpenOffice

PDF

[[Media:filename.pdf|PDF]]
[[File:filename.pdf|PDF]]

There are cases when the above syntax does not result in a link to "PDF". This seems to fix it - note leading colon:

[[:File:filename.pdf|PDF]]

Video

[[Media:video.asf|Video]]

Table of Contents

By default shows up after three headers. If you want to force, use:

__FORCETOC__

Templates

See:

Media Wiki Concepts - Templates

Syntax Highlighting

<syntaxhighlight lang="bash" line='line'>
...
</syntaxhighlight>
function test() {
  echo "this is a function"
}

where lang can be:

  • bash
  • java
  • xml

If the font size is too big, it can be corrected by putting the following CSS code fragment in MediaWiki:Common.css page. The page can be edited on-line at: https://kb.novaordis.com/index.php/MediaWiki:Common.css

/* CSS placed here will be applied to all skins */
.mw-highlight pre {
	font-size: 90%;
}

Math

https://en.wikipedia.org/wiki/Help:Displaying_a_formula