e49f23503e135c5c27bffb3ebf32f52673e540e8
[openafs-wiki.git] / TWiki / TextFormattingRules.mdwn
1 It is easy to collaborate; just type your text. You don't need to know HTML at all, though you can use it if you prefer. Links to topics will be created automatically, as long as you follow these simple Text Formatting Rules. [[TextFormattingFAQ]] has answers to frequently asked questions about text formatting.
2
3 <div>
4   <ul>
5     <li><a href="#Links"> Links</a></li>
6     <li><a href="#Editing"> Editing</a></li>
7     <li><a href="#Using HTML"> Using HTML</a></li>
8     <li><a href="#TWiki Variables"> TWiki Variables</a></li>
9     <li><a href="#"Gotchas" when Editing Text"> "Gotchas" when Editing Text</a></li>
10     <li><a href="#%WIKITOOLNAME% Plugins"> %WIKITOOLNAME% Plugins</a></li>
11   </ul>
12 </div>
13
14 ## <a name="Links"></a> Links
15
16 The Collaborative Work Area is a bunch of related links that are editable through your web browser.
17
18 ### <a name="%WIKITOOLNAME% Internal Links"></a> %WIKITOOLNAME% Internal Links
19
20 - [[GoodStyle]] is a [[WikiWord]] that links to the GoodStyle topic located in the current %WIKITOOLNAME% web.
21 - [[NotExistingYet]] is a topic waiting to be written. You could create that topic by clicking on the question mark. (Do not create that topic; you would wreck this example!)
22
23 ### <a name="External Links"></a> External Links
24
25 - `http://...`, `https://...`, `ftp://...` and `mailto:...@...` are linked automatically.
26 - Email addresses like `name@domain.com` are linked automatically.
27
28 ## <a name="Editing"></a> Editing
29
30 <table border="3" cellpadding="2" cellspacing="2">
31   <tr>
32     <td><strong>Formatting Command:</strong></td>
33     <td><strong>Example: You write:</strong></td>
34     <td><strong>You get:</strong></td>
35   </tr>
36   <tr>
37     <td valign="top"><strong>Paragraphs:</strong><br /> Blank lines will create new paragraphs. </td>
38     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
39 1st paragraph
40
41 2nd paragraph
42 </pre> </font></span></td>
43     <td valign="top"> 1st paragraph <p> 2nd paragraph </p>
44     </td>
45   </tr>
46   <tr>
47     <td valign="top"><strong>Headings:</strong><br /> At least three dashes at the beginning of a line, followed by plus signs and the heading text. One plus creates a level 1 heading (most important), two pluses a level 2 heading; the maximum is level 6. <strong><em>Note:</em></strong> A Table of Content can be created automatically with the <code>%TOC%</code> variable, see [[Main/TWikiVariables]]. </td>
48     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
49 ---++ Sushi
50
51 ---+++ Maguro
52 </pre> </font></span></td>
53     <td valign="top">
54       <h2>Sushi</h2>
55       <p>
56       </p>
57       <h3>Maguro</h3>
58     </td>
59   </tr>
60   <tr>
61     <td valign="top"><strong>Bold Text:</strong><br /> Words get <strong>bold</strong> by enclosing them in <code>*</code> asterisks. </td>
62     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
63 *Bold*
64 </pre> </font></span></td>
65     <td valign="top"><strong>Bold</strong></td>
66   </tr>
67   <tr>
68     <td valign="top"><strong>Italic Text:</strong><br /> Words get <em>italic</em> by enclosing them in <code>_</code> underscores. </td>
69     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
70 _Italic_
71 </pre> </font></span></td>
72     <td valign="top"><em>Italic</em></td>
73   </tr>
74   <tr>
75     <td valign="top"><strong>Bold Italic:</strong><br /> Words get <em>_bold italic</em> by enclosing them in <code>_</code> double-underscores. </td>
76     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
77 __Bold italic__
78 </pre> </font></span></td>
79     <td valign="top"><strong><em>Bold italic</em></strong></td>
80   </tr>
81   <tr>
82     <td valign="top"><strong>Fixed Font:</strong><br /> Words get shown in <code>fixed font</code> by enclosing them in <code>=</code> equal signs. </td>
83     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
84 =Fixed font=
85 </pre> </font></span></td>
86     <td valign="top"><code>Fixed font</code></td>
87   </tr>
88   <tr>
89     <td valign="top"><strong>Bold Fixed Font:</strong><br /> Words get shown in <code><b>bold fixed font</b></code> by enclosing them in <code><b></b></code> double equal signs. </td>
90     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
91 ==Bold fixed==
92 </pre> </font></span></td>
93     <td valign="top"><code><b>Bold fixed</b></code></td>
94   </tr>
95   <tr>
96     <td valign="top"><strong><em>Note:</em></strong> Make sure to "stick" the <code>* _ = ==</code> signs to the words, e.g. take away spaces. </td>
97     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
98 _This works_,
99 _this not _
100 </pre> </font></span></td>
101     <td valign="top"><em>This works</em>, _this not _ </td>
102   </tr>
103   <tr>
104     <td valign="top"><strong>Verbatim Mode:</strong><br /> Surround code excerpts and other formatted text with <code>&lt;verbatim&gt;</code> and <code>&lt;/verbatim&gt;</code> tags. <br /><strong><em>Note:</em></strong> Use <code>&lt;pre&gt;</code> and <code>&lt;/pre&gt;</code> tags instead if you want that HTML code is interpreted. <br /><strong><em>Note:</em></strong> Each tag must be on a line by itself. </td>
105     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
106 &lt;verbatim&gt;
107 class CatAnimal {
108   void purr() {
109          &lt;code here&gt;
110   }
111 }
112 &lt;/verbatim&gt;
113 </pre> </font></span></td>
114     <td valign="top"><pre>
115 class CatAnimal {
116   void purr() {
117     &lt;code here&gt;
118   }
119 }
120 </pre></td>
121   </tr>
122   <tr>
123     <td valign="top"><strong>Separator:</strong><br /> At least three dashes at the beginning of a line. </td>
124     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
125 -------
126 </pre> </font></span></td>
127     <td valign="top">
128       <hr />
129     </td>
130   </tr>
131   <tr>
132     <td valign="top"><strong>List Item:</strong><br /> Three spaces and an asterisk. </td>
133     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
134         * bullet item
135 </pre> </font></span></td>
136     <td valign="top">
137       <ul>
138         <li> bullet item </li>
139       </ul>
140     </td>
141   </tr>
142   <tr>
143     <td valign="top"><strong>Nested List Item:</strong><br /> Six, nine, ... spaces and an asterisk. </td>
144     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
145                 * nested stuff
146 </pre> </font></span></td>
147     <td valign="top">
148       <ul>
149         <li>
150           <ul>
151             <li> nested stuff </li>
152           </ul>
153         </li>
154       </ul>
155     </td>
156   </tr>
157   <tr>
158     <td valign="top"><strong>Ordered List:</strong><br /> Three spaces and a number. </td>
159     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
160         1 Sushi
161         1 Dim Sum
162 </pre> </font></span></td>
163     <td valign="top">
164       <ol>
165         <li> Sushi </li>
166         <li> Dim Sum </li>
167       </ol>
168     </td>
169   </tr>
170   <tr>
171     <td valign="top"><strong>Definition List:</strong><br /> Three spaces, the term, a colon, followed by the definition. <br /><strong><em>Note:</em></strong> Terms with spaces are not supported. In case you do have a term with more then one word, separate the words with dashes or with the <code>&amp;nbsp;</code> non-breaking-space entity. </td>
172     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
173         Sushi: Japan
174         Dim&amp;nbsp;Sum: S.F.
175 </pre> </font></span></td>
176     <td valign="top">
177       <dl>
178         <dt> Sushi</dt>
179         <dd> Japan </dd>
180         <dt> Dim Sum</dt>
181         <dd> S.F. </dd>
182       </dl>
183     </td>
184   </tr>
185   <tr>
186     <td valign="top"><strong>Table:</strong><br /> Optional spaces followed by the cells enclosed in vertical bars. <br /><strong><em>Note:</em></strong> <code>| *bold* |</code> cells are rendered as table headers. <br /><strong><em>Note:</em></strong> <code>|   spaced   |</code> cells are rendered center aligned. <br /><strong><em>Note:</em></strong> <code>|     spaced |</code> cells are rendered right aligned. <br /><strong><em>Note:</em></strong> <code>| 2 colspan ||</code> cells are rendered as multi-span columns. <br /><strong><em>Note:</em></strong> In case you have a long row and you want it to be more readable when you edit the table you can split the row into lines that end with a <code>'\'</code> backslash character. <br />
187     </td>
188     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
189 | *L* | *C* | *R* |
190 | A2 |  2  |  2 |
191 | A3 |  3  |  3 |
192 | multi span |||
193 | A4 \  | next \  | next |
194 </pre> </font></span></td>
195     <td valign="top">
196       <table border="1" cellpadding="0" cellspacing="0">
197         <tr>
198           <th bgcolor="#99CCCC"><strong> L </strong></th>
199           <th bgcolor="#99CCCC"><strong> C </strong></th>
200           <th bgcolor="#99CCCC"><strong> R </strong></th>
201         </tr>
202         <tr>
203           <td> A2 </td>
204           <td align="center"> 2 </td>
205           <td align="right"> 2 </td>
206         </tr>
207         <tr>
208           <td> A3 </td>
209           <td align="center"> 3 </td>
210           <td align="right"> 3 </td>
211         </tr>
212         <tr>
213           <td colspan="3"> multi span </td>
214         </tr>
215         <tr>
216           <td> A4 </td>
217           <td> next </td>
218           <td> next </td>
219         </tr>
220       </table>
221     </td>
222   </tr>
223   <tr>
224     <td valign="top"><strong>WikiWord Links:</strong><br /> CapitalizedWordsStuckTogether (or [[Main/WikiWords]]) will produce a link automatically. <br /><strong><em>Note:</em></strong> In case you want to link to a topic in a different %WIKITOOLNAME% web write <code>Webname.TopicName</code>. </td>
225     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
226 WebNotify
227
228 Know.ReadmeFirst
229 </pre> </font></span></td>
230     <td valign="top">[[Main/WebNotify]]<p>[[Know/ReadmeFirst]]</p>
231     </td>
232   </tr>
233   <tr>
234     <td valign="top"><strong>Forced Links:</strong><br /> You can create a forced internal link by enclosing words in double square brackets. <br /><strong><em>Note:</em></strong> Text within the brackets may contain optional spaces; the topic name is formed by capitalizing the initial letter and by removing the spaces; i.e. <code>[[text formatting FAQ]]</code> links to topic [[Main/TextFormattingFAQ]]. You can also refer to a different web and use anchors. </td>
235     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
236 [[wiki syntax]]
237
238 [[Main.TWiki users]]
239 </pre> </font></span></td>
240     <td valign="top">[[Main/WikiSyntax]]<p>[[Main/TWikiUsers]]</p>
241     </td>
242   </tr>
243   <tr>
244     <td valign="top"><strong>Specific Links:</strong><br /> Create a link where you can specify the link text and the link reference separately, using nested square brackets like <code>[[reference][text]]</code>. Internal link references (i.e. [[Main/WikiSyntax]]) and external link references (i.e. <a href="http://TWiki.org/" target="_top">http://TWiki.org/</a>) are supported. The same <strong><em>Forced Links</em></strong> rules apply for internal link references. Anchor names can be added as well, like <code>[[WebHome#MyAnchor][go home]]</code> and <code>[[http://www.yahoo.com/#somewhere][Yahoo!]]</code>. </td>
245     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
246 [[WikiSyntax][syntax]]
247
248 [[http://gnu.org][GNU]]
249 </pre> </font></span></td>
250     <td valign="top">[[Main/WikiSyntax]]<p><a href="http://gnu.org" target="_top">GNU</a></p>
251     </td>
252   </tr>
253   <tr>
254     <td valign="top"><strong>Anchors:</strong><br /> You can define a link reference inside a %WIKITOOLNAME% topic (called an anchor name) and link to that. To <strong><em>define</em></strong> an anchor write <code>#AnchorName</code> at the beginning of a line. The anchor name must be a [[Main/WikiWord]]. To <strong><em>link to</em></strong> an anchor name use the <code>[[MyTopic#MyAnchor]]</code> syntax. You can omit the topic name if you want to link within the same topic. </td>
255     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
256 [[WebHome#NotThere]]
257
258 [[#MyAnchor][Jump]]
259
260 #MyAnchor To here
261 </pre> </font></span></td>
262     <td valign="top">[[Main/WebHome#NotThere]]<p>[[Main/WebHome#MyAnchor]]</p>
263       <p><a name="MyAnchor"></a> To here </p>
264     </td>
265   </tr>
266   <tr>
267     <td valign="top"><strong>Prevent a Link:</strong><br /> Prevent a [[Main/WikiWord]] from being linked by prepending it with the <code>&lt;nop&gt;</code> tag. </td>
268     <td valign="top"><span style="background: #FFFFCC"><font color="#990000"> <pre>
269 &lt;nop&gt;SunOS
270 </pre> </font></span></td>
271     <td valign="top"> SunOS </td>
272   </tr>
273 </table>
274
275 ## <a name="Using HTML"></a> Using HTML
276
277 Most HTML tags will work, but it's almost always preferable not to use HTML, so that the markup remains easy for everyone to edit.
278
279 - HTML 4.01 Reference Specification: <http://www.w3.org/TR/html4/>
280 - Quick reference of all HTML elements: <http://werbach.com/barebones/barebones.html>
281
282 ## <a name="TWiki Variables"></a> TWiki Variables
283
284 Variables are names that are enclosed in percent signs; they get expanded on the fly.
285
286 - `%TOC%` : The table of content, is based on headings in a topic.
287 - `%WEB%` : The current web, is **%WEB%** .
288 - `%TOPIC%` : The current topic name, is **%TOPIC%** .
289 - `%ATTACHURL%` : The attachment URL of the current topic. Example usage: If you attach a file to a topic you can refer to it as <code>**%ATTACHURL%/image.gif**</code> to show the URL of the file or the image in your text.
290 - `%INCLUDE{"SomeTopic"}%` : Server side include, includes another topic. The current %WIKITOOLNAME% web is the default web. Example: <code>**%INCLUDE\{"TWiki.TWikiWebsTable"\}%**</code>
291 - There are many more variables, see [[TWikiVariables]].
292
293 ## <a name="&quot;Gotchas&quot; when Editing Text"></a> "Gotchas" when Editing Text
294
295 The formatting rules are fairly simple to use and fast to type. However, there are some things to watch out for:
296
297 - **Q:** Text enclosed in angle brackets like `<filename>` is not displayed. How can I show it as it is?
298   - **A:** The `'<'` and `'>'` characters have a special meaning in HTML, they define HTML tags. You need to escape them, so write `'&lt;'` instead of `'<'`, and `'&gt;'` instead of `'>'`. <br /> Example: Type `'prog &lt;filename&gt;'` to get `'prog <filename>'`.
299
300 - **Q:** Why is the `'&'` character sometimes not displayed?
301   - **A:** The `'&'` character has a special meaning in HTML, it starts a so called character entity, i.e. `'&copy;'` is the `©` copyright character. You need to escape `'&'` to see it as it is, so write `'&amp;'` instead of `'&'`. <br /> Example: Type `'This &amp; that'` to get `'This & that'`.
302
303 - See more [[TextFormattingFAQs]]
304
305 ## <a name="%WIKITOOLNAME% Plugins"></a> %WIKITOOLNAME% Plugins
306
307 %WIKITOOLNAME% Plugins offer additional text formatting rules. Plugins currently installed are:
308
309 - [[DefaultPlugin]]: The default plugin is used for some depreciated rendering of older TWiki versions.
310 -
311
312 Learn more about plugins in [[TWikiPlugins]] and [[TWikiPreferences]].