Basics
Click on the pencil icon situated on the top right of the page. A dropdown menu will appear containing the options available for a given page.
Creating a Page
To create a new page, navigate the address bar. Replace the last part of the URL with the name of the new page.
For example, to create a page named "New Page", the URL would be "https://darkanddarker.wiki.spellsandguns.com/New_Page".
This will take you to a temporary page that says "There is currently no text in this page. You can search for this page title in other pages, search the related logs, or create this page." Click on "create this page" to start editing.
Note that there are some limitations to valid page names. Trailing spaces, for example, will automatically be trimmed. See the linked resource for further information.
Editing a Page
Edit aka, "Visual Edit".
- Opens an experimental visual editor. For the most part, the content will look identical to page itself. However, the visual editor is not perfect and may break severely.
- Visual Edit has limited use. It isn't available on Template pages.
Edit Source
- Opens a codebox that highlights wikitext syntax.
- "Show preview" allows you to edit code and see the effects of your edits before committing the changes with "Save changes".
- If you enter an empty page, i.e. an existing page without content, try using Edit Source.
More likely than not, there is code that is hidden within <includeonly> html tags.
Uploading an Image
Images have a data limit of approximately 1MB. It is impossible to upload media larger than this limit.
- The default method of uploading a file.
- Destination filename will determine what the file is called.
- For when you wish to upload multiple files.
- Uploaded files will convert their filenames to destination names automatically. Ensure that the files are appropriately named beforehand.
- If uploading files with conflicting name, the most recent upload will overwrite the existing files.
- Be aware that users with basic permissions will be rate limited.
While exploring the wiki you may encounter broken links. Some of which are associated with a missing image. They will appear as a greyed-out link following the form: File:Missing example.png
- Clicking on such a link will lead to the Upload page, with the destination filename filled in.
MediaWiki
The Dark and Darker wiki runs on MediaWiki software.
This gives the wiki access to a few basic features like magic words, basic text markup, and sanitized HTML markup.
The sections below will touch upon most but not all of the commonly used elements on the Wiki.
For more comprehensive information and guides it is best to follow the included hyperlinks or reference the main MediaWiki manual
Built-In Features
Text Markup
Great for basic text formatting.
Generally not used in Template code, where text formatting requires more complex functionality like CSS and Parser Funtions.
HTML Markup
All html written within wikitext is sanitized. There are certain restrictions placed on what attributes and html elements are usable.
The purpose of this is to protect users from malicious actors. Beyond basic markup, this means javascript scripting is not permitted. Additionally, user-created style sheets are limited to either inline syntax, or to a controlled page extension.
<!--...-->
- HTML comments are commonly used to emulate the whitespace structures of more traditional languages like Python, Java, and C.
<span>...</span>
- This tag is used to apply CSS to a specific section of text. Think "inline" CSS.
<div>...</div>
- This tag is used to apply CSS to a "block", text or otherwise. Think "page element" CSS.
Transclusion
Transclusion is the process of including the content of one page within another page. Keeping content segmented with templates allows for easier editing and organization as one change can be reflected across multiple pages.
Additionally, transclusion allows for the creation of dynamic content, where the content of a page can change based on the parameters passed to the template.
{{Element|Spirit}} calls the Element template with "Spirit" as parameter 1.
- The first parameter is implicitly named "1", the second "2", and so on.
- On the template page itself, {{{1}}} is used to substitute whatever string is recieved for parameter 1.
- If a parameter is explicitly named, template calls must be formatted accordingly: {{Element|explicit-name=Spirit}}. Where the template page uses {{{explicit-name}}} to substitute the value of the named parameter.
- The basic search bar can be used to search for templates by prefixing the template name with the fixed namespace, "Template" (e.g. type "template:Element" into the search bar).
{{:Swords}} transcludes the Swords page.
- This is the same page you get when searching for "Swords" in the basic search bar. The ":" prefix denotes the Main namespace, which "regular pages" are part of by default.
{{{1|}}} inserts the value of the 1st unnamed parameter, or less commonly, the parameter named "1". Generally three curly braces are used to denote a parameter.
- The "|" specifies a default value in case the referenced parameter was not given one, in this example that default value is "". If a default value would be used but was not specified, "{{{1}}}" will be used instead.
Magic Words
{{PAGENAME}} returns the name of the page.
- Commonly used in Auto-templates to call templates with the name of the page.
{{lc: "string"}} returns "string" in lowercase.
- Primarily used as data validation to default strings to lowercase.
Extensions
ParserFunctions
{{#switch: "value" | case1 = result1 | case2 = result2 | ... | #default = resultN }} returns the result corresponding to the first case that matches value, or default if none match.
- The wiki's primary way of storing data. Used to create data templates.
{{#if: not "null" | value_if_true | value_if_false }} returns values depending on whether the if clause has a non empty string or not.
- Common formats:
- Inline:
- {{#if: condition | value_if_true | value_if_false }}
- Block:
- {{#if: condition<!--
-->| value_if_true<!--
-->| value_if_false }} - Note that the pipe characters begin the lines rather than end the lines.
When the "then clause" or the "else clause" have multiple lines, the code is easier to follow as you can identify where each clause begins at a glance.
This, in addition to indentation scope, makes it easy to parse the code visually. - The block format is used to emulate the whitespace structures of more traditional languages like Python, Java, and C.
Unless the condition is very simple, the block format is preferred as it is easier to read and edit.
- Inline:
{{#ifeq: value1 | value2 | value_if_equal | value_if_not_equal }} returns value_if_equal if value1 is equal to value2, and value_if_not_equal otherwise.
ParserFunctions/Strings
{{#pos: string | substring }} returns the position of the first occurrence of substring in string, or "null" if substring is not found.
- Used to like an "or" statement.
If the substring is found, the return value is not "null".
{{#replace: string | substring | replacement }} returns string with all occurrences of substring replaced by replacement.
- Typically used to replace commas with other separators.
{{#explode: string | delimiter | index | limit }} returns the index-th element of the list obtained by splitting string at each occurrence of delimiter.
- "limit" is optional. If you only need the first few elements, "limit" is used to save resources.
- If index is negative, the explode redturns in reverse index order.
- Explode is commonly used to split a string along some character(s), making it efficient to retrieve sections of a list-type string.
- Can be used to strip portions of a string.
Variables
{{#vardefineecho: variable_name | value }} returns value and defines variable_name as value.
- This is useful when handling data that is used more than once.
Calls to data templates eat up resources, so it is best practice to store the data in a variable and call the variable instead of the data template.
This is true even if the template data is only called twice. - Typically used within the "flow" of code, i.e. within a #if or #switch statement.
{{#vardefine: variable_name | value }} returns nothing and defines variable_name as value.
- Slightly less efficient than vardefineecho, but useful when you need to use a var in various scopes.
{{#var: variable_name }} returns the value of variable_name.
- Commonly used within a few lines of the vardefineecho.
- Unlike in traditional programming languages the return value is not "typed". It is a string.
- A common bug is to write the variable name but forget to include the curly braces and var tag.
So instead of referencing a variable's value you simply have a static string.
This sometimes goes unnoticed when using #var: with #if:.
Arrays
{{#arraydefine: variable_name | value1, value2, ... }} returns nothing and defines variable_name as an array.
- Commonly used to transform a comma separated list into an array.
- Occasionally used to transform comma separated lists into slash (or other) separated lists.
{{#arraysize: variable_name }} returns the number of elements in variable_name.
- Commonly used to set how many iterations of a loop to execute.
{{#arrayindex: variable_name | index }} returns the index-th element of variable_name.
- Almost always used with #loop to do work on individual elements in an list/array.
Loops
{{#loop: start | end | step | code }} returns the result of code executed for each value in the range start to end, incrementing by step.
Tabber
This extension allows content to be created under tabs.
The entire Wiki Editing page is organized using this extension.