Mediawiki

From TheBeard Science Project Wiki
Jump to: navigation, search

Syntax

Displaying plain text as-is (without parsing)

Text that is placed between the 'pre' tags will not be parsed and will display line breaks as is!

Example:

Hello
world

Would normally be displayed as:

Hello world

But if you use:

<pre>
  Hello
  world
<​/pre>

It will display like this:

Hello
world

To display text that would normally be parsed, break it up by putting a zero width space &#8​203; in the middle of it.

For instance, <&#82​03;font> will display as <​font> and &#82&#820​3;03; will display as &#82​03;


Including raw html

Edit the file "LocalSettings.php" in your Mediawiki folder.

Add the line $wgRawHtml = true;

You can now include raw html between < html> tags:

== This is a wiki page ==
<html>
  <iframe width="420" height="315" src="https://www.youtube.com/embed/somevideo" allowfullscreen></iframe>
</html>


Removing automatic numbering in table of contents

Go to "http://mydomain.com/wiki/index.php/MediaWiki:Common.css"

Edit the page and add the line:

.noautonum .tocnumber { display: none; }

Now, in any page that you don't want numbering, add the line:

<div class="noautonum">__TOC__</div>


Removing the table of contents

Add the keyword __NOTOC__ somewhere in your page.

Continue Numbering After a Tag

If written like the following, the numbering will break and start over at 1 on "Item 3":

# Item 1
# Item 2
<syntaxhighlight lang="shell">
echo "hello world"
</syntaxhighlight>
# Item 3
# Item 4

Example result:

  1. Item 1
  2. Item 2
echo "hello world"
  1. Item 3
  2. Item 4

But if written like the following, the numbering will continue (notice the colon ':' on the third line):

# Item 1
# Item 2
#:<syntaxhighlight lang="shell">
echo "hello world"
</syntaxhighlight>
# Item 3
# Item 4

Example result:

  1. Item 1
  2. Item 2
    echo "hello world"
    
  3. Item 3
  4. Item 4

Mediawiki tutorial on lists: https://www.mediawiki.org/wiki/Help:Lists

Prevent Wiki Formatting

The nowiki tag let's you prevent automatic formatting.

For example, bold text and links written like this:

'''Bold text''' http://example.com

Will display like this:

Bold text http://example.com


But if you use the nowiki tag:

<nowiki>'''Bold text''' http://example.com</nowiki>

It will display like this:

'''Bold text''' http://example.com


Linking to a Section

Add an anchor to the section title with a name field:

= <a name="Section-Title"></a> Section Title =

Then, anywhere in your text where you want to link to the section, use the #anchor notation to reference the anchor name:

To read more, go to [[#Section-Title|Section Title]].


Local Settings

Hide IP Address in Header

I use a web proxy for my wiki, and having the IP address in the header reveals the LAN IP address of my proxy server. To hide this, I added the following parameter to the LocalSettings.php file:

# Do not show client IP address in header
$wgShowIPinHeader = false;

Configuration Pages

Global CSS Stylesheet

http://mydomain.com/wiki/index.php/MediaWiki:Common.css

Sidebar Navigation List

http://mydomain.com/wiki/index.php/MediaWiki:Sidebar

Main Page Definition

http://mydomain.com/wiki/index.php/MediaWiki:Mainpage

Version

http://mydomain.com/wiki/index.php?title=Special:Version

Batch Upload

Using the SimpleBatchUpload extension: http://mydomain.com/wiki/index.php?title=Special:BatchUpload

Errors

Fatal exception of type MWException Error

This error occurred for me when I tried to upload a file. The "images" folder within the Mediawiki folder must be owned by the group "www-data" or "apache" (the web user of your particular install) and the permissions must be set to 775.

Assuming your web user is "www-data" and your Mediawiki folder is "/var/www/html/wiki":

  cd /var/www/html/wiki
  sudo chown -R :www-data images
  sudo chmod -R 775 images

Maintenance

Delete All Old Revisions

Run the file (where ROOT is the wiki root):

php ROOT/maintenance/deleteOldRevision.php --delete

You should also delete old archived revisions:

php ROOT/maintenance/deleteArchivedRevisions.php --delete