1 rizwank 1.1 %META:TOPICINFO{author="PeterThoeny" date="1095396914" format="1.0" version="1.48"}%
2 %TOC{depth="4"}%
3 %STARTINCLUDE%
4 ---# TWiki Text Formatting
5
6 Working in TWiki is as easy as typing in text - *exactly like email*. 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 - refer back to this page in a pop-up window from the *Edit* screen.
7
8 #TWikiShorthand
9 ---++ TWiki Editing Shorthand
10
11 <table border="1" cellpadding="3" cellspacing="1" bgcolor="#000000">
12 <tr bgcolor="#ffffff">
13 <td>
14 *Formatting Command:*
15 </td><td>
16 *Example: You write:*
17 </td><td>
18 *You get:*
19 </td>
20 </tr>
21 <tr bgcolor="#ffffff">
22 rizwank 1.1 <td valign="top">
23 *Paragraphs:* %BR%
24 Blank lines will create new paragraphs.
25 </td><td valign="top">
26 <span style='background : #FFFFCC;'><font color="#990000">
27 <pre>
28 1st paragraph
29
30 2nd paragraph
31 </pre>
32 </font></span>
33 </td><td valign="top">
34 1st paragraph
35
36 2nd paragraph
37 </td>
38 </tr>
39 <tr bgcolor="#ffffff">
40 <td valign="top">
41 *Headings:* %BR%
42 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. __Note:__ A Table of Content can be created automatically with the =%<nop>TOC%= variable, see TWikiVariables. Any heading text after =!!= is excluded from the TOC; for example, write =---+!! text= if you do not want to list a header in the TOC.
43 rizwank 1.1 </td><td valign="top">
44 <span style='background : #FFFFCC;'><font color="#990000">
45 <pre>
46 <nop>---++ Sushi
47
48 <nop>---+++ Maguro
49 </pre>
50 </font></span>
51 </td><td valign="top">
52 <h2 >Sushi</h2>
53
54 <h3 >Maguro</h3>
55 </td>
56 </tr>
57 <tr bgcolor="#ffffff">
58 <td valign="top">
59 *Bold Text:* %BR%
60 Words get *bold* by enclosing them in =*= asterisks.
61 </td><td valign="top">
62 <span style='background : #FFFFCC;'><font color="#990000">
63 <pre>
64 rizwank 1.1 *Bold*
65 </pre>
66 </font></span>
67 </td><td valign="top">
68 *Bold*
69 </td>
70 </tr>
71 <tr bgcolor="#ffffff">
72 <td valign="top">
73 *Italic Text:* %BR%
74 Words get _italic_ by enclosing them in =_= underscores.
75 </td><td valign="top">
76 <span style='background : #FFFFCC;'><font color="#990000">
77 <pre>
78 _Italic_
79 </pre>
80 </font></span>
81 </td><td valign="top">
82 _Italic_
83 </td>
84 </tr>
85 rizwank 1.1 <tr bgcolor="#ffffff">
86 <td valign="top">
87 *Bold Italic:* %BR%
88 Words get __bold italic_ by enclosing them in =_= double-underscores.
89 </td><td valign="top">
90 <span style='background : #FFFFCC;'><font color="#990000">
91 <pre>
92 __Bold italic__
93 </pre>
94 </font></span>
95 </td><td valign="top">
96 __Bold italic__
97 </td>
98 </tr>
99 <tr bgcolor="#ffffff">
100 <td valign="top">
101 *Fixed Font:* %BR%
102 Words get shown in =fixed font= by enclosing them in =<nop>=<nop>= equal signs.
103 </td><td valign="top">
104 <span style='background : #FFFFCC;'><font color="#990000">
105 <pre>
106 rizwank 1.1 =Fixed font=
107 </pre>
108 </font></span>
109 </td><td valign="top">
110 =Fixed font=
111
112 </td>
113 </tr>
114 <tr bgcolor="#ffffff">
115 <td valign="top">
116 *Bold Fixed Font:* %BR%
117 Words get shown in ==bold fixed font== by enclosing them in ==<nop>== double equal signs.
118 </td><td valign="top">
119 <span style='background : #FFFFCC;'><font color="#990000">
120 <pre>
121 ==Bold fixed==
122 </pre>
123 </font></span>
124 </td><td valign="top">
125 ==Bold fixed==
126 </td>
127 rizwank 1.1 </tr>
128 <tr bgcolor="#ffffff">
129 <td valign="top">
130 __Note:__ Make sure there is no space between the text and the bold, italic, or other indicators (=* _ __ = ===).
131 </td><td valign="top">
132 <span style='background : #FFFFCC;'><font color="#990000">
133 <pre>
134 _This works_,
135 _this not _
136 </pre>
137 </font></span>
138 </td><td valign="top">
139 _This works_,%BR%
140 _this not _
141 </td>
142 </tr>
143 <tr bgcolor="#ffffff">
144 <td valign="top">
145 *Verbatim Mode:* %BR%
146 Surround code excerpts and other formatted text with =<verbatim>= and =</verbatim>= tags. %BR% __Note:__ Use =<pre>= and =</pre>= tags instead if you want that HTML code is interpreted. %BR% __Note:__ Each tag must be on a line by itself.
147 </td><td valign="top">
148 rizwank 1.1 <span style='background : #FFFFCC;'><font color="#990000">
149 <pre>
150 <verbatim>
151 class CatAnimal {
152 void purr() {
153 <code here>
154 }
155 }
156 </verbatim>
157 </pre>
158 </font></span>
159 </td><td valign="top">
160 <verbatim>
161 class CatAnimal {
162 void purr() {
163 <code here>
164 }
165 }
166 </verbatim>
167 </td>
168 </tr>
169 rizwank 1.1 <tr bgcolor="#ffffff">
170 <td valign="top">
171 *Separator:* %BR%
172 At least three dashes at the beginning of a line.
173 </td><td valign="top">
174 <span style='background : #FFFFCC;'><font color="#990000">
175 <pre>
176 -------
177 </pre>
178 </font></span>
179 </td><td valign="top">
180 -------
181 </td>
182 </tr>
183 <tr bgcolor="#ffffff">
184 <td valign="top">
185 *List Item:* %BR%
186 Three spaces, an asterisk, and another space.
187 </td><td valign="top">
188 <span style='background : #FFFFCC;'><font color="#990000">
189 <pre>
190 rizwank 1.1 * bullet item
191 </pre>
192 </font></span>
193 </td><td valign="top">
194 * bullet item
195 </td>
196 </tr>
197 <tr bgcolor="#ffffff">
198 <td valign="top">
199 *Nested List Item:* %BR%
200 Six, nine, ... spaces, an asterisk, and another space.
201 </td><td valign="top">
202 <span style='background : #FFFFCC;'><font color="#990000">
203 <pre>
204 * level 1
205 * level 2
206 </pre>
207 </font></span>
208 </td><td valign="top">
209 * level 1
210 * level 2
211 rizwank 1.1 </td>
212 </tr>
213 <tr bgcolor="#ffffff">
214 <td valign="top">
215 *Ordered List:* %BR%
216 Three spaces, a number, a dot, and another space. Several types are available besides a number:
217 | *Type* | *Generated Style* | *Sample Sequence* |
218 | 1. | Arabic numerals | 1, 2, 3, 4... |
219 | A. | Uppercase letters | A, B, C, D... |
220 | a. | Lowercase letters | a, b, c, d... |
221 | I. | Uppercase Roman Numerals | I, II, III, IV... |
222 | i. | Lowercase Roman Numerals | i, ii, iii, iv... |
223
224 </td><td valign="top">
225 <span style='background : #FFFFCC;'><font color="#990000">
226 <pre>
227 1. Sushi
228 1. Dim Sum
229
230 A. Sushi
231 A. Dim Sum
232 rizwank 1.1
233 i. Sushi
234 i. Dim Sum
235 </pre>
236 </font></span>
237 </td><td valign="top">
238 1. Sushi
239 1. Dim Sum
240
241 A. Sushi
242 A. Dim Sum
243
244 i. Sushi
245 i. Dim Sum
246 </td>
247 </tr>
248 <tr bgcolor="#ffffff">
249 <td valign="top">
250 *Definition List:* %BR%
251 Three spaces, a dollar sign, the term, a colon, a space, followed by the definition.
252 </td><td valign="top">
253 rizwank 1.1 <span style='background : #FFFFCC;'><font color="#990000">
254 <pre>
255 $ Sushi: Japan
256 $ Dim Sum: S.F.
257 </pre>
258 </font></span>
259 </td><td valign="top">
260 $ Sushi: Japan
261 $ Dim Sum: S.F.
262 </td>
263 </tr>
264 <tr bgcolor="#ffffff">
265 <td valign="top">
266 *Table:* %BR%
267 Any number of lines of text. Each line is one row of the table consisting of one or more cells. Each cell starts and ends with a vertical bar '|'. Any spaces at the beginning of a line are ignored.%BR%
268 __Notes:__ %BB%
269 =| <nop>*bold*<nop> |= cells are displayed as table headers.%BB%
270 =| center-spaced |= cells are displayed center aligned.%BB%
271 =| right-spaced |= cells are displayed right aligned.%BB%
272 =| 2 colspan ||= cells are displayed as multi-span columns (i.e., a cell with no text spans a column).%BB%
273 =|^|= cells with a caret indicate follow-up rows of multi-span rows (this functionality is provided by TablePlugin).%BB%
274 rizwank 1.1 If a row contains a large amount of text, and you want it to be more readable while editing the table, split the row into multiple text lines by ending each line with a backslash character ='\'=.%BB%
275 Table cells wrap automatically as determined by the browser.
276 </td><td valign="top">
277 <span style='background : #FFFFCC;'><font color="#990000">
278 <pre>
279 | *L* | *C* | *R* |
280 | A2 | 2 | 2 |
281 | A3 | 3 | 3 |
282 | multi span |||
283 | A4-6 | four | four |
284 |^| five | five |
285
286
287
288 |^| six | six |
289 </pre>
290 </font></span>
291 </td><td valign="top">
292 | *L* | *C* | *R* |
293 | A2 | 2 | 2 |
294 | A3 | 3 | 3 |
295 rizwank 1.1 | multi span |||
296 | A4-6 | four | four |
297 |^| five | five |
298 |^| six | six |
299 </td>
300 </tr>
301 <tr bgcolor="#ffffff">
302 <td valign="top">
303 *<nop>WikiWord Links:* %BR%
304 <nop>CapitalizedWordsStuckTogether (or WikiWords) will produce a link automatically if preceeded by whitespace or parenthesis. %BR% __Note:__ In case you want to link to a topic in a different %WIKITOOLNAME% web write =Otherweb.TopicName=. (The link label is the the name of the web in case the is <nop>%HOMETOPIC%, else it is the topic name)
305 </td><td valign="top">
306 <span style='background : #FFFFCC;'><font color="#990000">
307 <pre>
308 WebNotify
309
310 %MAINWEB%.TWikiUsers
311 </pre>
312 </font></span>
313 </td><td valign="top">
314 WebNotify
315
316 rizwank 1.1 %MAINWEB%.TWikiUsers
317 </td>
318 </tr>
319 <tr bgcolor="#ffffff">
320 <td valign="top">
321 #SquareBrackets
322 *Forced Links:* %BR%
323 You can create a forced internal link by enclosing words in double square brackets.
324 %BR% __Note:__ 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.
325 %BR% __Note:__ To "escape" double square brackets that would otherwise be a correct link, prefix the leading left square brackets with an exclamation point, that is, begin with =![<nop>[....=
326 </td><td valign="top">
327 <span style='background : #FFFFCC;'><font color="#990000">
328 <pre>
329 [[wiki syntax]]
330
331 [[%MAINWEB%.TWiki users]]
332
333 escaped:
334 ![[wiki syntax]]
335 </pre>
336 </font></span>
337 rizwank 1.1 </td><td valign="top">
338 [[wiki syntax]]
339
340 [[%MAINWEB%.TWiki users]]
341
342 escaped:
343 ![[wiki syntax]]
344 </td>
345 </tr>
346 <tr bgcolor="#ffffff">
347 <td valign="top">
348 *Specific Links:* %BR%
349 Create a link where you can specify the link text and the link reference separately, using nested square brackets like =[<nop>[reference][text]]=. Internal link references (e.g. WikiSyntax) and external link references (e.g. http://TWiki.org/) are supported.
350 %BR% __Note:__ The same __Forced Links__ rules apply for internal link references.
351 %BR% __Note:__ For external link references, you can simply use a space instead of =][= to separate the link URL from the descriptive text.
352 %BR% __Note:__ Anchor names can be added as well, like =[<nop>[%HOMETOPIC%#MyAnchor][go home]]= and =[<nop>[http://gnu.org/#Action][GNU Action]]=.
353 </td><td valign="top">
354 <span style='background : #FFFFCC;'><font color="#990000">
355 <pre>
356 [[WikiSyntax][syntax]]
357
358 rizwank 1.1 [[http://gnu.org][GNU]]
359
360 [[http://xml.org XML]]
361 </pre>
362 </font></span>
363 </td><td valign="top">
364 [[WikiSyntax][syntax]]
365
366 [[http://gnu.org][GNU]]
367
368 [[http://xml.org XML]]
369 </td>
370 </tr>
371 <tr bgcolor="#ffffff">
372 <td valign="top">
373 *Anchors:* %BR%
374 You can define a link reference inside a %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.
375 </td><td valign="top">
376 <span style='background : #FFFFCC;'><font color="#990000">
377 <pre>
378 [[WikiWord#NotThere]]
379 rizwank 1.1
380 [[#MyAnchor][Jump]]
381
382 #MyAnchor To here
383 </pre>
384 </font></span>
385 </td><td valign="top">
386 [[WikiWord#NotThere]]
387
388 [[#MyAnchor][Jump]]
389
390 #MyAnchor To here
391 </td>
392 </tr>
393 <tr bgcolor="#ffffff">
394 <td valign="top">
395 *Prevent a Link:* %BR%
396 Prevent a WikiWord from being linked by prepending it with an exclamation point.
397 </td><td valign="top">
398 <span style='background : #FFFFCC;'><font color="#990000">
399 <pre>
400 rizwank 1.1 !SunOS
401 </pre>
402 </font></span>
403 </td><td valign="top">
404 !SunOS
405 </td>
406 </tr>
407 <tr bgcolor="#ffffff">
408 <td valign="top">
409 *Disable Links:* %BR%
410 You can disable automatic linking of WikiWords by surrounding text with =<noautolink>= and =</noautolink>= tags.
411 %BR% __Note:__ Each tag must be on a line by itself.
412 %BR% __Note:__ This also works for TWiki tables, but only if you add a blank line between the end of the table and the closing =</noautolink>= tag (known issue of the TablePlugin).
413 </td><td valign="top">
414 <span style='background : #FFFFCC;'><font color="#990000">
415 <verbatim>
416 <noautolink>
417 RedHat &
418 SuSE
419 </noautolink>
420 </verbatim>
421 rizwank 1.1 </font></span>
422 </td><td valign="top">
423 <noautolink>
424 RedHat &
425 SuSE
426 </noautolink>
427 </td>
428 </tr>
429 <tr bgcolor="#ffffff">
430 <td valign="top">
431 *Mailto: Links:* %BR%
432 To create 'mailto:' links that have more descriptive link text, specify subject lines or message bodies, or omit the email address, you can write =[<nop>[mailto:user@domain descriptive text]]=.
433 </td><td valign="top">
434 <span style='background : #FFFFCC;'><font color="#990000">
435 <pre>
436 [[mailto:a@z.com Mail]]
437
438 [[mailto:?subject=Hi Hi]]
439 </pre>
440 </font></span>
441 </td><td valign="top">
442 rizwank 1.1 [[mailto:a@z.com Mail]]
443
444 [[mailto:?subject=Hi Hi]]
445 </td>
446 </tr>
447 </table>
448
449 ---++ Using HTML
450
451 You can use just about any HTML tag without a problem - however, there are a few usability and technical considerations to keep in mind.
452
453 ---+++ HTML and TWiki Usability
454
455 * %T% *TIP:* On collaboration pages, it's preferable NOT to use HTML, and to use [[#TWikiShorthand][TWiki shorthand]] instead - this keeps the text uncluttered and easy to edit.
456 * %X% *NOTE:* TWiki is designed to work with a wide range of browsers and computer platforms, holding to HTML 4.0 and XHTML 1.0 compatibility in the standard installation - adding raw HTML, particularly browser-specific tags (or any other mark-up that doesn't degrade well) will reduce compatibility.
457 * Recommondations when using HTML:
458 * Use [[http://www.w3.org/TR/xhtml1/][XHTML 1.0 Transitional]] syntax
459 * Do not span a tag over more then one line
460 * Remove all empty lines. TWiki inserts =<p />= paragraph tags on empty lines, which causes problems if done between tags that do not allow paragraph tags, like for example between table tags.
461
462
463 rizwank 1.1 ---+++ TWiki HTML Rendering
464
465 * TWiki converts shorthand notation to XHTML 1.0 for display. To copy a fully marked-up page, simply view source in your browser and save the contents.
466 * %T% If you need to save HTML frequently, you may want to check out TWiki:Plugins/GenHTMLAddon - it will "generate a directory containing rendered versions of a set of TWiki pages together with any attached files."
467 * %X% *NOTE:* The opening and closing angle brackets - ==<...>== - of an HTML tag __must be on the same line__, or the tag will be broken.
468 * This feature allows you to enter an unclosed angle bracket - as a greater than or less than symbol - and have it automatically rendered as if you had entered its HTML character, =&lt;=, ex: ==a < b==
469 * %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.
470
471 ---+++ TWiki and <nop>JavaScript
472
473 You can use <nop>JavaScript for your TWiki applications. Since TWiki rendering might interfere with <nop>JavaScript code you need to escape it with HTML comments and =<pre>= tags:
474 <verbatim>
475 <script type="text/javascript">
476 <!-- Hide JavaScript and <pre> escape TWiki rendering
477 ... put your JavaScript code here...
478 // Stop hiding and stop </pre> escaping TWiki rendering -->
479 </script>
480 </verbatim>
481
482 ---++ Hyperlinks
483
484 rizwank 1.1 Being able to create links without any formatting required is a core TWiki feature, made possible with WikiWords. New TWiki linking rules are a simple extension of the syntax that provide a new set of flexible options.
485
486 ---+++ Internal Links
487
488 * GoodStyle is a WikiWord that links to the <nop>GoodStyle topic located in the current %WIKITOOLNAME% web.
489
490 * 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!)
491
492 ---+++ External Links
493
494 * =http://...=, =https://...=, =ftp://...=, =gopher://...=, =news://...=, =file://...=, =telnet://...=
495 and =mailto:...@...= are linked automatically.
496
497 * Email addresses like =name@domain.com= are linked automatically.
498
499 * =[<nop>[Square bracket rules]]= let you easily create [[#SquareBrackets][non-WikiWord links]].
500 * 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]].
501
502
503 ---++ TWiki Variables
504
505 rizwank 1.1 Variables are names that are enclosed in percent signs =%= that are expanded on the fly.
506
507 * =%<nop>TOC%= : Automatically generates a table of contents based on headings in a topic - see the top of this page for an example.
508
509 * =%<nop>WEB%= : The current web, is <b>%WEB%</b>.
510
511 * =%<nop>TOPIC%= : The current topic name, is <b>%TOPIC%</b>.
512
513 * =%<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.
514
515 * =%<nop>INCLUDE{"SomeTopic"}%= : Server side include, includes another topic. The current %WIKITOOLNAME% web is the default web. Example: =<b>%<nop>INCLUDE{"%TWIKIWEB%.SiteMap"}%</b>=
516
517 * =%<nop>SEARCH{"sushi"}%= : Inline search showing the search result embedded in a topic. FormattedSearch gives you control over formatting, used to create web-based applications.
518
519 * TWikiPreferences defines site-wide variables. Among others:
520 * *Line break:* Write =<span style='background : #FFFFCC;'><font color="#990000">%<nop>BR%</font></span>= to start a new line.
521 * *Colored text:* Write: =<span style='background : #FFFFCC;'><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.
522 * *Documentation Graphics:* Write: =<span style='background : #FFFFCC;'><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.
523
524 * There are many more variables, see *[[TWikiVariables]]*.
525
526 rizwank 1.1 * To "escape" a variable, prefix it with an exclamation point. Write: =<span style='background : #FFFFCC;'><font color="#990000"> !%<nop>SOMEVARIABLE% </font></span>= to get: !%SOMEVARIABLE%.
527
528 ---++ <nop>TWikiPlugin Formatting Extensions
529
530 Plugins provide additional text formatting capabilities and can extend the functionality of %WIKITOOLNAME% into many other areas. For example, the optional [[http://twiki.org/cgi-bin/view/Plugins/SpreadSheetPlugin][SpreadSheetPlugin]] lets you create a spreadsheet with the same basic notation used in TWiki tables.
531
532 Available Plugins are located in 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%=:
533
534 %PLUGINDESCRIPTIONS%
535
536 Check on current Plugin status and settings for this site in TWikiPreferences.
537
538
539 ---++ Common Editing Errors
540
541 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:
542
543 * *Q:* Text enclosed in angle brackets like =<filename>= is not displayed. How can I show it as it is?
544 * *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>'=.
545
546 * *Q:* Why is the ='&'= character sometimes not displayed?
547 rizwank 1.1 * *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'=.
548
549 -- TWiki:Main.MikeMannix - 02 Dec 2001 <br />
550 -- TWiki:Main.PeterThoeny - 01 Aug 2004
551
|