Using Wikibooks/Wiki-Markup
Wikitext Basics
editWikitext is very simple, and one of the best ways to learn is by seeing and doing. When you see a page with fancy formatting, click "edit this page" to see the code. Some things are self-explanatory. Some things are not.
As we mentioned before, Wikitext can often be used interchangeably with HTML and CSS code. If you are not familiar with HTML and CSS, some of the most advanced formatting will be difficult for you to reproduce on your own. However, do not despair! There are no deadlines, things do not need to be perfect immediately, and you have plenty of time to learn and experiment here.
If you want to experiment with wikitext and editing, you can go to the Sandbox. The sandbox is a page where you can make edits without getting in trouble. If you have something you want to try, do it at the sandbox!
Not enough information? We have an entire book about Wikitext that includes many detailed descriptions, many examples, and a deeper look at some of the more advanced features of wikitext. For more information, see the book Editing Wikitext. |
Paragraphs
editNew paragraphs can be made by creating the new paragraph in the code. E.g.
This code will create 2 paragraphs. This is the first. This is the second.
will give you:
This code will create 2 paragraphs. This is the first.
This is the second.
Formatting: Bold and Italics
editText can be bolded or italicized to place emphasis on a certain word or phrase. To bold text, place three apostrophes (''') before and after the word or phrase you wish to bold E.g.
'''This is an incredibly bold statement'''
will give you
This is an incredibly bold statement
Bolding is usually used for the first appearance of an important term, E.g. in a mathematics book you might have "Integral calculus is...", followed by a definition. Another use of bolding is with entire sentences for emphasis of important information, E.g. in a chemistry book a recipe might be given for black powder, but after that there might be something like "Don't try making this at home!". You can probably think of more uses for bold text, these are just some general examples.
To italicize text, place two apostrophes ('', not to be confused with a quotation mark, ") before and after the phrase you wish to italicize E.g.
''This sentence looks slanty''
will give you
This sentence looks slanty
Italicized text can be used for adding emphasis to text when making a point, E.g. "You don't really need to do this but...", where people are probably going to read the "really" with a longer sound in their head than when they see the normal "really". Another use is when naming the titles of books and movies, E.g. "In William Shakespeare's Romeo and Juliet, ...".
These two types of formatting can be combined by first putting the 3 apostrophes for bold text and then the 2 for italicized text E.g.
'''''A bold Italian might write like this...'''''
creates
A bold Italian might write like this...
This might be used to emphasize important information while providing the same effect as italics in emphasis. It can also be used if you are making an annotated text for a book. You might start you introduction with the wikitext
J. R. R. Tolkien's novel, '''''The Lord of the Rings''''', was written...
and this would look like
J. R. R. Tolkien's novel, The Lord of the Rings, was written...
Bulleted and Numbered Lists
editTo create a bulleted list, simply place an asterisk in front of every addition to the list. For example:
*Number one *Number two *Number three
will show up as:
- Number one
- Number two
- Number three
You can also indent particular bullets. To do so, just add another asterisk to the start of a line. For example:
*Number one **Number two *Number three
will show up as:
- Number one
- Number two
- Number three
Numbered lists are just as easy. Place a # sign in front of every addition, and they will be automatically numbered. For example:
#Number one #Number two #Number three
will show up as:
- Number one
- Number two
- Number three
Numbered lists can also be indented. Add another # to the start of every line, like so:
#Number one #Number two ##Number two point one ##Number two point two #Number three
This will show up as:
- Number one
- Number two
- Number two point one
- Number two point two
- Number three
Preformatted Text
editPreformatted text is rendered in a fixed-width font like Courier, and respects literal whitespace. This is most useful for writing software code, but also comes in handy in other places where things need to be made to line up in certain ways. Normally, using tables or divs should be used to align data, but sometimes preformatted text does what you want and does it better.
This is preformatted text. Text here will render exactly how it appears. If you do not add inline breaks when you edit this page, the text will run off the edge of the screen. Notice how this text appears in a little box? We can put text where we want it:
A B C
Fixed-width fonts are good for lining things up and displaying literal text with respect to whitespace. It's typically considered bad for readability, and can be more difficult to edit because whitespace needs to be monitored.
Page Links
editThere are about 2 ways to link to other pages in wikibooks. One way is to simply put the URL of the page in the code E.g.
http://en.wikibooks.org/wiki/Main_Page
gives
This is a bad idea when just doing a simple link to another page in wikibooks, because it doesn't look very neat, and is more reserved for external links to other websites for references and extra reading, e.g., a wikibook on nonsense might include http://www.encyclopediadramatica.com in its “External links” section for further reading.
For simple links to other pages in Wikibooks, you take the part of the URL after http://en.wikibooks.org/wiki/, in the above example this would be Main_Page, and put a double pair of brackets around it, like this:
[[Main_Page]]
this makes
Main_Page is the name of the main page of wikibooks. You might wonder why your link has an underscore in it when all the other links you've seen just have spaces. When making links, the mediawiki software replaces spaces with underscores, because page names in wikibooks, and other Wikimedia projects, don't allow spaces in the page name. So you could have done the same thing with [[Main Page]]. Another thing with page names is that they always start with a capitalized first letter, and the software running wikibooks automatically converts the first letter in a link to upper case, so you could have typed [[main Page]] and gotten the same thing.
You're probably wondering if page names are case-sensitive now, because the lone 'P' looks out of place amongst all the other lower case characters. Well it is, so [[main Page]] and [[main page]] would link to two different pages.
Try clicking on [[main Page]] and [[main page]] to see the difference.
You're probably wondering why, if the two links are supposed to go to different pages, they instead point to the same page. This is because [[main page]] points to a page which is a redirect. So when you click on the link, you go to http://en.wikibooks.org/wiki/Main_page, but the page will be replaced with the page from http://en.wikibooks.org/wiki/Main_Page, and up the top left of the page there is a little piece of text saying (Redirected from Main page).
This is a very useful feature which makes it much easier to link to pages, because people have already thought of common page names people might try in links to link to certain pages, and have gone and created those pages as redirects, so that we little people don't need to bother ourselves with this case sensitivity stuff.
So that is how you link to a page in wikibooks. You can link to subpages as well, e.g.
[[Using_Wikibooks/The_Wikibooks_Editor/Cleanup_and_Maintenance]]
gives
This is pretty ugly, and just as bad as posting a URL to the page. This can be avoided by using a pipe character |. By putting a pipe character at the end of the page name, and then typing in another name after it, still inside the double brackets, you can change the text displayed for the link without changing the link. So instead of a big long link like Using Wikibooks/The Wikibooks Editor/Cleanup and Maintenance, you can do
[[Using_Wikibooks/The_Wikibooks_Editor/Cleanup_and_Maintenance|Cleanup and Maintenance]]
which gives
It doesn't matter if you want to add spaces in the link to space things out and make it more readable
[[ Using_Wikibooks/The_Wikibooks_Editor/Cleanup_and_Maintenance | Cleanup and Maintenance ]]
still makes
It's usually best to link to a whole page, but occasionally you may want to link to a section of a page. To do that, after the name of the page to link to, add a # and the name of the section. So
[[Using Wikibooks/The Wikibooks Editor/Cleanup and Maintenance#Moves and Mergers|Moves and Mergers]]
gives
Linking to a particular section can be a bit risky in the long run, because if the section later gets renamed, the link will just go to the top of the target page. The same goes if you get the name of the section wrong, even slightly; for example, if you used the wrong capitalization in specifying the link target,
[[Using Wikibooks/The Wikibooks Editor/Cleanup and Maintenance#Moves and mergers|Moves and Mergers]]
would give
Most links are to pages in the same book, most links that aren't to the same book are to other pages on Wikibooks, but occasionally we do link to other sister projects, such as Wikipedia. To link to a page on a sister project, prefix the target page name with the name of the sister project and a colon; most projects have a one- or two-letter abbreviation that can be used. For example, you could link to Wikipedia with [[w:Tensor calculus|tensor calculus]] or [[wikipedia:Tensor calculus|tensor calculus]], either of which gives tensor calculus.