%META:TOPICINFO{author="TWikiContributor" date="1111929255" format="1.0" version="48"}%
%TOC{depth="4"}%
%STARTINCLUDE%
---# TWiki Text Formatting

Working in TWiki is as easy as typing in text. You don't need to know HTML, though you can use it if you prefer. Links to topics are created automatically when you enter WikiWords. And TWiki shorthand gives you all the power of HTML with a simple coding system that takes no time to learn. It's all laid out below.

#TWikiShorthand
---++ TWiki Editing Shorthand

%TABLE{}%
<table class="twikiTable" border="1" cellpadding="3" bgcolor="#ffffff">
<tr bgcolor="#ffffff">
<th width="50%">
 Formatting Command:
</th>
<th width="25%">
 You write:
</th>
<th width="25%">
 You get:
</th>
</tr>
<tr valign="top">
<td>
 *Paragraphs:* %BR%
 Blank lines will create new paragraphs.
</td><td>
<verbatim>
1st paragraph

2nd paragraph
</verbatim>
</td><td>
1st paragraph

2nd paragraph
</td>
</tr>
<tr valign="top">
<td>
 *Headings:* %BR%
Three or more dashes at the beginning of a line, followed by plus signs and the heading text. One plus creates a top level heading, two pluses a second level heading, etc. The maximum heading depth is 6.

You can create a table of contents with the [[TWikiVariables#VarTOC][%<nop>TOC%]] variable. If you want to *exclude* a heading from the TOC, put =!!= after the =---+=.

%X% Empty headings are allowed, but won't appear in the table of contents.
</td><td>
<verbatim>
---++ Sushi
---+++ Maguro
---++++!! Exclude from TOC
</verbatim>
</td><td>
<h2 >Sushi</h2>
<h3 >Maguro</h3>
<h4 >Exclude from TOC</h4>
</td>
</tr>
<tr valign="top">
<td>
 *Bold Text:* %BR%
 Words get shown in *bold* by enclosing them in =*= asterisks.
</td><td>
<verbatim>
*Bold*
</verbatim>
</td><td>
*Bold*
</td>
</tr>
<tr valign="top">
<td>
 *Italic Text:* %BR%
 Words get shown in _italic_ by enclosing them in =_= underscores.
</td><td>
<verbatim>
_Italic_
</verbatim>
</td><td>
_Italic_
</td>
</tr>
<tr valign="top">
<td>
 *Bold Italic:* %BR%
 Words get shown in __bold italic__ by enclosing them in =__= double-underscores.
</td><td>
<verbatim>
__Bold italic__
</verbatim>
</td><td>
__Bold italic__
</td>
</tr>
<tr valign="top">
<td>
 *Fixed Font:* %BR%
 Words get shown in =fixed font= by enclosing them in =<nop>=<nop>= equal signs.
</td><td>
<verbatim>
=Fixed font=
</verbatim>
</td><td>
=Fixed font=

</td>
</tr>
<tr valign="top">
<td>
 *Bold Fixed Font:* %BR%
 Words get shown in ==bold fixed font== by enclosing them in ==<nop>== double equal signs.
</td><td>
<verbatim>
==Bold fixed==
</verbatim>
</td><td>
==Bold fixed==
</td>
</tr>
<tr valign="top">
<td>
%T% You can follow the closing bold, italic, or other (=* _ __ = ===) indicator
with normal punctuation, such as commas and full stops.

%X% Make sure there is no space between the text and the indicators.
</td><td>
<verbatim>
_This works_,
_this does not _
</verbatim>
</td><td>
_This works_,%BR%
_this does not _
</td>
</tr>
<tr valign="top">
<td>
 *Separator (horizontal rule):* %BR%
Three or more three dashes at the beginning of a line..
</td><td>
<verbatim>
-------
</verbatim>
</td><td>
-------
</td>
</tr>
<tr valign="top">
<td>
 *Bulleted list:* %BR%
Multiple of three spaces, an asterisk, and another space.
</td><td>
<verbatim>
	* bullet item level 1
		* bullet item level 2
	* back to level 1
</verbatim>
</td><td>
	* bullet item level 1
		* bullet item level 2
	* back to level 1
</td>
</tr>
<tr valign="top"><td>
%H% For all the list types, you can break a list item over several lines by indenting lines after the first one by *at least 3 spaces* e.g.
</td><td>
<verbatim>
	* A bullet
	broken over
	three lines.
This text is not indented
</verbatim>
</td><td>
	* A bullet
	broken over
	three lines.
This text is not indented
</td></tr>
<tr valign="top">
<td>
*Numbered List:* %BR%
Multiple of three spaces, a type character, a dot, and another space. Several types are available besides a number:
| *Type* | *Generated Style* | *Sample Sequence* |
| 1. | Arabic numerals | 1, 2, 3, 4... |
| A. | Uppercase letters | A, B, C, D... |
| a. | Lowercase letters | a, b, c, d... |
| I. | Uppercase Roman Numerals | I, II, III, IV... |
| i. | Lowercase Roman Numerals | i, ii, iii, iv... |
</td><td>
<verbatim>
	1. Mammals
		1. Rodents
			A. Rats
			A. Mice
			A. Capybaras
		i. Bats
			1. Pipistrelle
			1. Horseshoe
				(lesser)
</verbatim>
</td><td>
	1. Mammals
		1. Rodents
			A. Rats
			A. Mice
			A. Capybaras
		i. Bats
			1. Pipistrelle
			1. Horseshoe
				(lesser)
</td>
</tr>
<tr valign="top">
<td>
 *Definition List:* %BR%
 Three spaces, a dollar sign, the term, a colon, a space, followed by the definition.
</td><td>
<verbatim>
	$ Sushi: Japan
	$ Dim Sum: S.F.
</verbatim>
</td><td>
	$ Sushi: Japan
	$ Dim Sum: S.F.
</td>
</tr>
<tr valign="top">
<td>
 *Table:* %BR%
Each row of the table is a line containing of one or more cells. Each cell starts and ends with a vertical bar '|'. Any spaces at the beginning of a line are ignored.
	* to make a cell a header, put the text in asterisks =| <nop>*bold*<nop> |=
	* to center the contents of a cell, put an equal number of spaces on either side of the text (you need more than one space on each side)
	* to right-align, put more spaces on the left |	  right-spaced |=
	* to span multiple columns, put the =|='s right next to each other =| 2 colspan ||=
	* You can split rows over multiple lines by putting a backslash ='\'= at the end of each line
	* Contents of table cells wrap automatically as determined by the browser.
%T% The %TWIKIWEB%.TablePlugin increases the number of things you can do with tables - for example, you can control formatting, and create multi-row spans by using a single caret (^) to indicate follow-up rows.
</td><td>
<verbatim>
| *L* | *C* | *R* |
| A2 |  2  |  2 |
| A3 |  3  |  3 |
| multi span |||
| A4-6 | \
four \
| four |
</verbatim>
</td><td>
| *L* | *C* | *R* |
| A2 |  2  |  2 |
| A3 |  3  |  3 |
| multi span |||
| A4-6 | \
four \
| four |
</td>
</tr>
<tr valign="top">
<td>
 *<nop>WikiWord Links:* %BR%
 <nop>CapitalizedWordsStuckTogether (or WikiWords) will produce a link automatically. %BR%
If you want to link to a topic in a different <nop>%WIKITOOLNAME% web write =Otherweb.TopicName=. (The link label is the the name of the web if it is <nop>%HOMETOPIC%, otherwise it is the topic name)
</td><td>
<verbatim>
WebNotify

%MAINWEB%.TWikiUsers
</verbatim>
</td><td>
WebNotify

%MAINWEB%.TWikiUsers
</td>
</tr>
<tr valign="top">
<td>
 *Verbatim (Literal) text:* %BR%
 Surround code excerpts and other formatted text with =&lt;verbatim&gt;= and =&lt;/verbatim&gt;= tags.

%T% =verbatim= tags disable HTML code. Use =&lt;pre&gt;= and =&lt;/pre&gt;= tags instead if you want the HTML code within the tags to be interpreted.

*NOTE:* VARIABLES are still Set within verbatim tags (this is a historical peculiarity)
</td><td>
<verbatim>
<verbatim>
class CatAnimal {
  void purr() {
	 <code here>
  }
}
</verbatim>
</verbatim>
</td><td>
<verbatim>
class CatAnimal {
  void purr() {
	 <code here>
  }
}
</verbatim>
</td>
</tr>
<tr valign="top">
<td>
 *Anchors:* %BR%
 You can define a reference inside a <nop>%WIKITOOLNAME% topic (called an anchor name) and link to that. To __define__ an anchor write =#AnchorName= at the beginning of a line. The anchor name must be a WikiWord. To __link to__ an anchor name use the =[<nop>[MyTopic#MyAnchor]]= syntax. You can omit the topic name if you want to link within the same topic.
</td><td>
<verbatim>
[[WikiWord#NotThere]]

[[#MyAnchor][Jump]]

#MyAnchor To here
</verbatim>
</td><td>
[[WikiWord#NotThere]]

[[#MyAnchor][Jump]]

#MyAnchor To here
</td>
</tr>
<tr valign="top">
<td>
#HeRe
 *Forced Links:* %BR%
 You can create a forced internal link by enclosing words in double square brackets.
%BR% 
Text within the brackets may contain optional spaces; the topic name is formed by capitalizing the initial letter and by removing the spaces; for example, =[<nop>[text formatting FAQ]]= links to topic TextFormattingFAQ.  You can also refer to a different web and use anchors.
%BR%
%T% To "escape" double square brackets that would otherwise make a link, prefix the leading left square bracket with an exclamation mark !
</td><td>
<verbatim>
[[wiki syntax]]

[[%MAINWEB%.TWiki users]]

escaped:
![[wiki syntax]]
</verbatim>
</td><td>
[[wiki syntax]]

[[%MAINWEB%.TWiki users]]

escaped:
![[wiki syntax]]
</td>
</tr>
<tr valign="top">
<td>
 *Specific Links:* %BR%
 You can create a link where you specify the link text and the URL separately using nested square brackets =[<nop>[reference][text]]=. Internal link references (e.g. WikiSyntax) and URLs (e.g. http://TWiki.org/) are both supported.
The rules described under __Forced Links__ apply for internal link references.
 %BR% %T% Anchor names can be added as well, to create a link to a specific place in a topic.
</td><td>
<verbatim>
[[WikiSyntax][wiki syntax]]

[[http://gnu.org][GNU]]

[[mailto:a@b.street][mail]]
</verbatim>
</td><td>
[[WikiSyntax][wiki syntax]]

[[http://gnu.org][GNU]]

[[mailto:a@b.com][mail]]
</td>
</tr>
<tr valign="top">
<td>
 *Prevent a Link:* %BR%
 Prevent a WikiWord from being linked by prepending it with an exclamation mark.
</td><td>
<verbatim>
!SunOS
</verbatim>
</td><td>
!SunOS
</td>
</tr>
<tr valign="top">
<td>
 *Disable Links:* %BR%
 You can disable automatic linking of WikiWords by surrounding text with =&lt;noautolink&gt;= and =&lt;/noautolink&gt;= tags. Each tag must be on a line by itself.
</td><td>
<verbatim>
 <noautolink>
 RedHat &
 SuSE
 </noautolink>
</verbatim>
</td><td>
 <noautolink>
 RedHat &
 SuSE
 </noautolink>
</td>
</tr>
</table>

---++ Using HTML

You can use just about any HTML tag without a problem - however, there are a few usability and technical considerations to keep in mind.
	* On collaboration pages, it's better *not* to use HTML, but to use [[#TWikiShorthand][TWiki shorthand]] instead - this keeps the text uncluttered and easy to edit.
	* Use [[http://www.w3.org/TR/xhtml1/][XHTML 1.0 Transitional]] syntax
	* Remove all empty lines. TWiki inserts =&lt;p /&gt;= paragraph tags on empty lines, which causes problems if done between HTML tags that do not allow paragraph tags, like for example between table tags.
	* Remove leading spaces. TWiki might interpret some text as lists.
	* Do not span a tag over more than one line
	* %X% Script tags may be filtered out, at the discretion of your sysadmin

	* %T% If you're pasting in preformatted HTML text and notice problems, check the file in a text processor with no text wrap. Also, save without hard line breaks on text wrap, in your HTML editing program.

%T% TWiki converts shorthand notation to HTML for display. To copy a fully marked-up page, simply view source in your browser and save the contents. If you need to save HTML frequently, you may want to check out TWiki:Plugins/PublishAddOn.

%X% *NOTE:* TWiki requires that the opening and closing angle brackets - ==&lt;...&gt;== - of an HTML tag __must be on the same line__, or the tag will be broken.

---+++ Script tags

You can use HTML =&lt;script>= tags in for your TWiki applications. However note that your TWiki administrator can disable =&lt;script>= in topics, and may have chosen to do so for security considerations. TWiki markup and TWikiVariables are *not* expanded inside script tags.

---++ Hyperlinks

Being able to create links without any special formatting is a core TWiki feature, made possible with WikiWords and inline URLs.

---+++ Internal Links

	* GoodStyle is a WikiWord that links to the <nop>GoodStyle topic located in the current <nop>%WIKITOOLNAME% web.

	* NotExistingYet is a topic waiting to be written. Create the topic by clicking on the *?*. (Try clicking, but then, *Cancel* - creating the topic would wreck this example!)

---+++ External Links

	* =http://...=, =https://...=, =ftp://...=, =gopher://...=, =news://...=, =file://...=, =telnet://...=
	  and =mailto:...@...= are linked automatically.

	* Email addresses like =name@domain.com= are linked automatically.

	* =[<nop>[Square bracket rules]]= let you easily create [[#SquareBrackets][non-WikiWord links]].
		* You can also write =[<nop>[http://yahoo.com Yahoo home page]]= as an easier way of doing external links with descriptive text for the link, such as [[http://yahoo.com/ Yahoo home page]].

---++ TWiki Variables

TWiki Variables are names that are enclosed in percent signs =%= that are expanded on the fly.

	* =%<nop>TOC%= : Automatically generates a table of contents based on headings in a topic - see the top of this page for an example.

	* =%<nop>WEB%= : The current web, is <b><nop>%WEB%</b>.

	* =%<nop>TOPIC%= : The current topic name, is <b>%TOPIC%</b>.

	* =%<nop>ATTACHURL%= : The attachment URL of the current topic. Example usage: If you attach a file to a topic you can refer to it as =<b>%<nop>ATTACHURL%/image.gif</b>= to show the URL of the file or the image in your text.

	* =%<nop>INCLUDE{"SomeTopic"}%= : Server side include, includes another topic. The current <nop>%WIKITOOLNAME% web is the default web. Example: =<b>%<nop>INCLUDE{"%TWIKIWEB%.SiteMap"}%</b>=

	* =%<nop>SEARCH{"sushi"}%= : Inline search showing the search result embedded in a topic. FormattedSearch gives you control over formatting, useful for creating web-based applications.

	* TWikiPreferences defines some site-wide variables. Among others:
		* *Line break:* Write =<span style='background:#ffc;'><font color="#990000">%<nop>BR%</font></span>= to start a new line.
		* *Colored text:* Write: =<span style='background:#ffc;'><font color="#990000"> %<nop>RED% Red %<nop>ENDCOLOR% and %<nop>BLUE% blue %<nop>ENDCOLOR% colors</font></span>= to get: %RED% Red %ENDCOLOR% and %BLUE% blue %ENDCOLOR% colors.
		* *Documentation Graphics:* Write: =<span style='background:#ffc;'><font color="#990000"> %<nop>H% Help, %<nop>T% Tip, %<nop>X% Alert</font></span>= to get: %H% Help, %T% Tip, %X% Alert. For more info see TWikiDocGraphics.

	* There are many more variables, see *[[TWikiVariables]]*.

	* To "escape" a variable, prefix it with an exclamation mark. Write: =!%<nop>SOMEVARIABLE%= to get: !%SOMEVARIABLE%.

---++ <nop>TWikiPlugin Formatting Extensions

Plugins can extend the functionality of TWiki into many other areas. There are a huge number of TWiki plugins available from the [[http://twiki.org/cgi-bin/view/Plugins][Plugins]] web on TWiki.org.

Currently enabled plugins on this TWiki installation, as listed by =%<nop>PLUGINDESCRIPTIONS%=:
%PLUGINDESCRIPTIONS%

Check on current Plugin status and settings for this site in TWikiPreferences.

---++ Common Editing Errors

TWiki formatting rules are fairly simple to use and quick to type. However, there are some things to watch out for, taken from the TextFormattingFAQ:

	* *Q:* Text enclosed in angle brackets like =&lt;filename&gt;= is not displayed. How can I show it as it is?
		* *A:* The ='&lt;'= and ='&gt;'= characters have a special meaning in HTML, they define HTML tags. You need to escape them, so write ='&amp;lt;'= instead of ='&lt;'=, and ='&amp;gt;'= instead of ='&gt;'=. <br /> Example: Type ='prog &amp;lt;filename&amp;gt;'= to get ='prog &lt;filename&gt;'=.

	* *Q:* Why is the ='&'= character sometimes not displayed?
		* *A:* The ='&'= character has a special meaning in HTML, it starts a so called character entity, i.e. ='&amp;copy;'= is the =&copy;= copyright character. You need to escape ='&amp;'= to see it as it is, so write ='&amp;amp;'= instead of ='&amp;'=. <br /> Example: Type ='This &amp;amp; that'= to get ='This &amp; that'=.




