TWiki . TWiki .
TextFormattingRules
(edit)
Change topic
%TOC{depth="4"}% %STARTINCLUDE% ---# TWiki Text Formatting 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 layed out below - refer back to this page in a pop-up window from the *Edit* screen. #TWikiShorthand ---++ TWiki Editing Shorthand <table border="1" cellpadding="3" cellspacing="1" bgcolor="#000000"> <tr bgcolor="#ffffff"> <td> *Formatting Command:* </td><td> *Example: You write:* </td><td> *You get:* </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Paragraphs:* %BR% Blank lines will create new paragraphs. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> 1st paragraph 2nd paragraph </pre> </font></span> </td><td valign="top"> 1st paragraph 2nd paragraph </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Headings:* %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. __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. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> <nop>---++ Sushi <nop>---+++ Maguro </pre> </font></span> </td><td valign="top"> <h2 >Sushi</h2> <h3 >Maguro</h3> </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Bold Text:* %BR% Words get *bold* by enclosing them in =*= asterisks. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> *Bold* </pre> </font></span> </td><td valign="top"> *Bold* </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Italic Text:* %BR% Words get _italic_ by enclosing them in =_= underscores. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> _Italic_ </pre> </font></span> </td><td valign="top"> _Italic_ </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Bold Italic:* %BR% Words get __bold italic_ by enclosing them in =_= double-underscores. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> __Bold italic__ </pre> </font></span> </td><td valign="top"> __Bold italic__ </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Fixed Font:* %BR% Words get shown in =fixed font= by enclosing them in =<nop>=<nop>= equal signs. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> =Fixed font= </pre> </font></span> </td><td valign="top"> =Fixed font= </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Bold Fixed Font:* %BR% Words get shown in ==bold fixed font== by enclosing them in ==<nop>== double equal signs. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> ==Bold fixed== </pre> </font></span> </td><td valign="top"> ==Bold fixed== </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> __Note:__ Make sure to "stick" the =* _ = <nop>==<nop>= signs to the words, that is, take away spaces. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> _This works_, _this not _ </pre> </font></span> </td><td valign="top"> _This works_, _this not _ </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Verbatim Mode:* %BR% 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. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> <verbatim> class CatAnimal { void purr() { <code here> } } </verbatim> </pre> </font></span> </td><td valign="top"> <verbatim> class CatAnimal { void purr() { <code here> } } </verbatim> </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Separator:* %BR% At least three dashes at the beginning of a line. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> ------- </pre> </font></span> </td><td valign="top"> ------- </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *List Item:* %BR% Three spaces and an asterisk. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> * bullet item </pre> </font></span> </td><td valign="top"> * bullet item </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Nested List Item:* %BR% Six, nine, ... spaces and an asterisk. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> * nested stuff </pre> </font></span> </td><td valign="top"> * nested stuff </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Ordered List:* %BR% Three spaces and a number. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> 1 Sushi 1 Dim Sum </pre> </font></span> </td><td valign="top"> 1 Sushi 1 Dim Sum </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Definition List:* %BR% Three spaces, the term, a colon, a space, followed by the definition. %BR% __Note:__ 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 =&nbsp;= non-breaking-space entity. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> Sushi: Japan Dim&nbsp;Sum: S.F. </pre> </font></span> </td><td valign="top"> Sushi: Japan Dim Sum: S.F. </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Table:* %BR% Optional spaces followed by the cells enclosed in vertical bars. %BR% __Note:__ =| <nop>*bold*<nop> |= cells are rendered as table headers. %BR% __Note:__ =| spaced |= cells are rendered center aligned. %BR% __Note:__ =| spaced |= cells are rendered right aligned. %BR% __Note:__ =| 2 colspan ||= cells are rendered as multi-span columns. %BR% __Note:__ 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 ='\'= backslash character. %BR% </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> | *L* | *C* | *R* | | A2 | 2 | 2 | | A3 | 3 | 3 | | multi span ||| | A4 | next | next | </pre> </font></span> </td><td valign="top"> | *L* | *C* | *R* | | A2 | 2 | 2 | | A3 | 3 | 3 | | multi span ||| | A4 | next | next | </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *<nop>WikiWord Links:* %BR% <nop>CapitalizedWordsStuckTogether (or WikiWords) will produce a link automatically. %BR% __Note:__ In case you want to link to a topic in a different %WIKITOOLNAME% web write =Webname.TopicName=. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> WebNotify Know.ReadmeFirst </pre> </font></span> </td><td valign="top"> WebNotify Know.ReadmeFirst </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> #SquareBrackets *Forced Links:* %BR% You can create a forced internal link by enclosing words in double square brackets. %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. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> [[wiki syntax]] [[%MAINWEB%.TWiki users]] </pre> </font></span> </td><td valign="top"> [[wiki syntax]] [[%MAINWEB%.TWiki users]] </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Specific Links:* %BR% 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. %BR% __Note:__ The same __Forced Links__ rules apply for internal link references. %BR% __Note:__ For external link references, you can simply use a space instead of =][= to separate the link URL from the descriptive text. %BR% __Note:__ Anchor names can be added as well, like =[<nop>[WebHome#MyAnchor][go home]]= and =[<nop>[http://gnu.org/#Action][GNU Action]]=. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> [[WikiSyntax][syntax]] [[http://gnu.org][GNU]] [[http://xml.org XML]] </pre> </font></span> </td><td valign="top"> [[WikiSyntax][syntax]] [[http://gnu.org][GNU]] [[http://xml.org XML]] </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Anchors:* %BR% 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. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> [[WebHome#NotThere]] [[#MyAnchor][Jump]] #MyAnchor To here </pre> </font></span> </td><td valign="top"> [[WebHome#NotThere]] [[#MyAnchor][Jump]] #MyAnchor To here </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Prevent a Link:* %BR% Prevent a WikiWord from being linked by prepending it with the =<nop>= tag. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> <nop>SunOS </pre> </font></span> </td><td valign="top"> <nop>SunOS </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Disable Links:* %BR% You can disable automatic linking of WikiWords by surrounding text with =<noautolink>= and =</noautolink>= tags. %BR% __Note:__ Each tag must be on a line by itself. %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). </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <verbatim> <noautolink> RedHat & SuSE </noautolink> </verbatim> </font></span> </td><td valign="top"> <noautolink> RedHat & SuSE </noautolink> </td> </tr> <tr bgcolor="#ffffff"> <td valign="top"> *Mailto: Links:* %BR% 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]]=. </td><td valign="top"> <span style='background : #FFFFCC;'><font color="#990000"> <pre> [[mailto:a@z.com Mail]] [[mailto:?subject=Hi Hi]] </pre> </font></span> </td><td valign="top"> [[mailto:a@z.com Mail]] [[mailto:?subject=Hi Hi]] </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. ---+++ HTML and TWiki Usability * 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. * %X% *NOTE:* TWiki is designed to work with a wide range of browsers and computer platforms, holding to HTML 3.2 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. ---+++ TWiki HTML Rendering * 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. * %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." * %X% *NOTE:* The opening and closing angle brackets - ==<...>== - of an HTML tag __must be on the same line__, or the tag will be broken. * 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== * %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. ---++ Hyperlinks 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. ---+++ Internal Links * GoodStyle is a WikiWord that links to the <nop>GoodStyle topic located in the current %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 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>%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 %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, used to create web-based applications. * TWikiPreferences defines site-wide variables. Among others: * *Line break:* Write =<span style='background : #FFFFCC;'><font color="#990000">%<nop>BR%</font></span>= to start a new line. * *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. * *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. * There are many more variables, see *[[TWikiVariables]]*. ---++ <nop>TWikiPlugin Formatting Extensions 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. 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%=: %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 =<filename>= is not displayed. How can I show it as it is? * *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>'=. * *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. ='&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'=. -- Main.MikeMannix - 02 Dec 2001 <br /> -- Main.PeterThoeny - 01 Feb 2003
Don't forget - if you change something, do it in
GoodStyle
and follow the
TextFormattingRules
.
-- Main.TWikiGuest - 02 Feb 2025
<==
This is your signature for easy copy & paste operation
Topic
TextFormattingRules
. {
|
Cancel
edit }
Copyright © 1999-2003 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send
feedback.