Help:MediaWiki basics/Intermediate training

From LIMSWiki
Jump to navigationJump to search

Intermediate formatting in MediaWiki

Note: When opening links from wiki pages, right-click a link and choose to open it in a new tab. This should make navigating your way through the wiki less complex.

Text formatting revisited

In the beginner training guide we talked about simple text formatting methods like bolding and italicizing. Now let's cover a few more advanced ways to format your text.

Preformatted text

If you viewed the beginner training guide, you likely noticed several instances of gray boxes with wiki code and other text in them. How do you display that content like that without the system running any associated code? You do it by using the preformatted text tag <pre> to display the code without rendering it. For example, here is the code used to create that box at the top of this page, displayed (but not run) using the <pre> tag, the content, and then the closing </pre>:

{{ombox
| type      = notice
| style     = width: 960px;
| text      = This is intermediate training material for MediaWiki. If you still have problems after reviewing and practicing the material found here and in the [[Help:MediaWiki basics/Beginner training|beginner]] and [[Help:MediaWiki basics/Advanced training|advanced]] guides, you can request help on [[User_talk:Shawndouglas|this discussion page]].
}}

The code and nowiki tags

If you wish to show some sort of code inline, without the big block of gray, you can combine two HTML-style tags to create that effect: <code> and <nowiki>. For example, here's the same code from above but inline:

{{ombox | type = notice | style = width: 960px; | text = This is intermediate training material for MediaWiki. If you still have problems after reviewing and practicing the material found here and in the [[Help:MediaWiki basics/Beginner training|beginner]] and [[Help:MediaWiki basics/Advanced training|advanced]] guides, you can request help on [[User_talk:Shawndouglas|this discussion page]]. }}

We achieve that by doing the following:

<code><nowiki>
{{ombox
| type      = notice
| style     = width: 960px;
| text      = This is intermediate training material for MediaWiki. If you still have problems after reviewing and practicing the material found here and in the [[Help:MediaWiki basics/Beginner training|beginner]] and [[Help:MediaWiki basics/Advanced training|advanced]] guides, you can request help on [[User_talk:Shawndouglas|this discussion page]].
}}
</nowiki></code>

Essentially the <code> tag tells the system to show the text inline instead of in block format (like preformatted text), and the <nowiki> tag tells the system to not run that text as code but treat it as plain text.

Note: Leave <pre> for larger blocks. Using the described combination of tags is much better suited for small bits of code. For example: [[Help:MediaWiki basics/Beginner training|beginner training guide]]

This may seem a bit confusing at first, but don't worry. You'll get the hang of this type of formatting.