1 rizwank 1.1 %META:TOPICINFO{author="PeterThoeny" date="1092606139" format="1.0" version="1.17"}%
2 ---++ Text Formatting FAQ
3
4 The most frequently asked questions about text formatting are answered. Also, TextFormattingRules contains the complete TWiki shorthand system on one quick reference page.
5
6 %TOC%
7
8 ---
9 ---+++ How do I make a separator?
10
11 Create a separator - a horizontal rule - by entering three dashes at the beginning of a blank line: =---=. You can enter more than three if you like, for a more visible separator in edit mode: <br />
12 =--------------=
13
14 --------------
15 ---+++ How do I create a heading?
16
17 You can create six sizes of headings - <h1>...<h6> in HTML - by typing, from the beginning of a line, three dashes (-), from one to six plus signs (+), a space, and your heading text. The FAQ questions on this page are created with: =---+++ Have a question?=.
18 * You can insert a nested table of contents, generated from headings, by placing =%<nop>TOC%= wherever you like on a page (see %TWIKIWEB%.TWikiVariables for more =%<nop>TOC%= options).
19
20 -----
21 #TextEnclosed
22 rizwank 1.1 ---+++ Text enclosed in angle brackets like <filename> is not displayed. How can I show it as it is?
23
24 TWiki interprets text as HTML, and the '<' and '>' characters define where HTML commands start and end. Text _inside_ angle brackets is treated as HTML, and ignored if it doesn't actually do anything - either way, the brackets and its contents are not displayed.
25
26 If you want to display angle brackets, enter them as HTML codes instead of typing them in directly:
27 * =&lt;= = =<= <br />
28 =&gt;= = =>=
29
30 * __You enter:__ =(a &gt; 0)= <p />
31 __Result:__ =(a > 0)=
32
33 ---
34 ---+++ Some words appear highlighted, with a "?" link at the end. How can I prevent that?
35
36 A question mark after a word is a link to a topic that doesn't yet exist - click it to create the new page. This is a TWiki feature - typing a MeaningfulTitle in a comment is an invitation for someone else to add a new branch to the topic.
37
38 To prevent auto-linking - say you want to enter a word like <nop>JavaScript (the proper spelling!) - prefix the WikiStyleWord with an exclamation point:
39
40 * =!WikiStyleWord= displays as !WikiStyleWord
41
42 ---
43 rizwank 1.1 ---+++ How can I write fixed font text?
44
45 The quickest way is to enclose the text in equal signs:
46
47 * __You enter:__ =Proportional text, <nop>=fixed font=<nop>, proportional again.= <p />
48 __Result:__ Proportional text, =fixed font=, proportional again.
49
50 ---
51 #VerbatimText
52 ---+++ Text I enter gets wrapped around. How can I keep the formatting as it is?
53
54 TWiki interprets text as HTML, so you can use the =preformatted= HTML option to keep the new line of text as is. Enclose the text in <pre> </pre>, or in TWiki's own <verbatim> </verbatim> tag:
55 <pre>
56 This text will keep its format as it is:
57 <verbatim>
58 Unit Price Qty Cost
59 ------- ------ --- ------
60 aaa 12.00 3 36.00
61 </verbatim>
62 </pre>
63
64 rizwank 1.1 The =pre= tag is standard HTML; =verbatim= is a special TWiki tag that forces text to fixed font mode, and also prevents other tags and TWiki shortcuts from being expanded.
65
66 ---
67 ---+++ How do I create tables?
68
69 There are three possibilities:
70 1 Use Wiki rule with "|" vertical bars.
71 2 Use HTML tables with <table>, <tr>, <td> tags.
72 3 Use preformatted text with <verbatim> tags.
73
74 *1. Use Wiki rule with "|" vertical bars*
75
76 * Example text: <br>
77 =| cell A1 | cell B1 | cell C1 |= <br>
78 =| cell A2 | cell B2 | cell C2 |=
79 * Example output:
80 | cell A1 | cell B1 | cell C1 |
81 | cell A2 | cell B2 | cell C2 |
82
83 *2. Use HTML tables with <table>, <tr>, <td> tags*
84
85 rizwank 1.1 This is a manual process using HTML commands.
86
87 __You enter:__
88
89 <pre>
90 <table border="1">
91 <tr>
92 <th> Head A </th> <th> Head B </th>
93 </tr><tr>
94 <td> Cell A2 </td> <td> Cell B2 </td>
95 </tr><tr>
96 <td> Cell A3 </td> <td> Cell B3 </td>
97 </tr>
98 </table>
99 </pre>
100
101 __Result:__
102
103 <table border="1">
104 <tr>
105 <th> Head A </th> <th> Head B </th>
106 rizwank 1.1 </tr><tr>
107 <td> Cell A2 </td> <td> Cell B2 </td>
108 </tr><tr>
109 <td> Cell A3 </td> <td> Cell B3 </td>
110 </tr>
111 </table>
112
113 *3. Use preformatted text with <verbatim> tags*
114
115 See [[#VerbatimText]["Text I enter gets wrapped around..."]]
116
117
118 ---
119
120 ---+++ Can I include images on a page?
121
122 Yes. The easiest way is to [[FileAttachment][attach]] a GIF, JPG or PNG file to a topic and then to place it with: =%<nop>ATTACHURL%/myImage.gif=. This works only for the page that the image is attached to.
123
124 To place an image on any page, ther are two ways of including inline images.
125
126 *1. Using URL ending in .gif, .jpg, .jpeg, .png*
127 rizwank 1.1
128 This is a simple and automatic way of including inline images. Simply write the URL of the image file, this will create the inline image for you. __NOTE:__ The images must be [[#ImgUpload][accessible]] as a URL.
129
130 * __You enter:__ <code> TWiki <nop>%PUBURL%/%TWIKIWEB%/TWikiLogos/twikilogo88x31.gif logo.</code> <br />
131 __Result:__ TWiki %PUBURL%/%TWIKIWEB%/TWikiLogos/twikilogo88x31.gif logo.
132
133 #ImgUpload
134 You can upload images directly to your server with FTP access. You can also [[FileAttachment][attach]] image files to a topic - you could even create a dedicated image topic, like =ImageLibrary= - and then link to the images directly:
135 * Attach =pic.gif= to =Someweb.SomeTopic= <br />
136 Display with =<no>%PUBURL%/Someweb/<nop>SomeTopic/pic.gif=
137
138 *2. Using <img> tag*
139
140 This is a manual process where you have more control over the rendering of the image. Use the <img> tag of HTML to include GIF, JPG and PNG files. *Note:* The display of the topic is faster if you include the =WIDTH= and =HEIGHT= parameters that have the actual image size. http://www.htmlhelp.com/reference/wilbur/special/img.html has more on inline images.
141
142 * __You enter:__ <code>TWiki <img src="%PUBURL%/%TWIKIWEB%/TWikiLogos/twikilogo88x31.gif" width="88" height="31" border="0" alt="logo" /> logo.</code><br />
143 __Result:__ <br /> TWiki <img src="%PUBURL%/%TWIKIWEB%/TWikiLogos/twikilogo88x31.gif" width="88" height="31" border="0" alt="logo" /> logo.
144
145 -----
146 ---+++ Can I write colored text?
147
148 rizwank 1.1 TWikiPreferences defines some commonly used colors: *%YELLOW% %<nop>YELLOW%%ENDCOLOR%, %RED% %<nop>RED%%ENDCOLOR%, %PINK% %<nop>PINK%%ENDCOLOR%, %PURPLE% %<nop>PURPLE%%ENDCOLOR%, %TEAL% %<nop>TEAL%%ENDCOLOR%, %NAVY% %<nop>NAVY%%ENDCOLOR%, %BLUE% %<nop>BLUE%%ENDCOLOR%, %AQUA% %<nop>AQUA%%ENDCOLOR%, %LIME% %<nop>LIME%%ENDCOLOR%, %GREEN% %<nop>GREEN%%ENDCOLOR%, %OLIVE% %<nop>OLIVE%%ENDCOLOR%, %MAROON% %<nop>MAROON%%ENDCOLOR%, %BLACK% %<nop>BLACK%%ENDCOLOR%, %GRAY% %<nop>GRAY%%ENDCOLOR%, %SILVER% %<nop>SILVER%%ENDCOLOR%* and *%<nop>ENDCOLOR%*.
149
150 * __You enter:__ =%<nop>RED% red text %<nop>ENDCOLOR% and %<nop>GREEN% green text %<nop>ENDCOLOR%= <p />
151 __Result:__ %RED% red text %ENDCOLOR% and %GREEN% green text %ENDCOLOR%
152
153 __Note:__ =%<color>%= text must end with =%<nop>ENDCOLOR%= . If you want to switch from one color to another one you first need to end the active color with =%<nop>ENDCOLOR%=, e.g. write =%<nop>RED% some text %<nop>ENDCOLOR% %<nop>GREEN% more text %<nop>ENDCOLOR%=.
154
155 If you need more colors you can use HTML, like =<font color="#ff0000"> red text </font>=. You can also use the up-to-date =style= attribute - ex: =style="color:#ff0000"= - placed in most HTML tags. =span= is an all-purpose choice: =<span style="color:#ff0000">CoLoR</span>=. Only old (like 3.x IE & NS) browsers have a problem with =style=.
156
157 The code is the _hexadecimal RGB color code_, which is simply Red, Green and Blue values in hex notation (base 16, 0-F). For pure red, the RGB components are 255-0-0 - full red (255), no green or blue. That's FF-0-0 in hex, or ="#ff0000"= for Web page purposes. StandardColors lists basic colors.
158
159 -----
160
161 -- TWiki:Main.PeterThoeny - 15 Aug 2004 %BR%
162 -- TWiki:Main.MikeMannix - 14 Sep 2001 %BR%
163
|