TWiki Text Formatting

These instructions are for contributors who prefer to use the Raw Edit over the default WYSIWYG editor. 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.

TWiki Editing Shorthand

No permission to view TWiki.TWikiEditingShorthand

Using HTML, CSS and JavaScript

You can use most HTML tags in TWiki topics without a problem. This is useful where you want to add some content that is formatted in a way that is not supported using TWiki shorthand, for example, you can write <strike>deleted text</strike> to get deleted text.

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 TWiki shorthand instead - this keeps the text uncluttered and easy to edit using the plaintext editor.
  • If you must use HTML, use XHTML 1.0 Transitional syntax.
  • Use <literal>..</literal> tags around blocks of HTML to avoid accidental interpretation of TWiki shorthand within the HTML.
  • ALERT! Script tags may be filtered out, at the discretion of your TWiki administrator.

Recommendations when pasting HTML from other sources (using the plain-text editor):

  • Copy only text between <body> and </body> tags.
  • Remove all empty lines. TWiki inserts <p /> 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. TWiki requires that the opening and closing angle brackets - <...> - of a HTML tag are on the same line, or the tag will be broken.
  • In your HTML editing program, save without hard line breaks on text wrap.

When using a WYSIWYG editor, you can just copy-paste directly into the editor, and the content will be converted to TWiki shorthand automatically when you save.

It is also possible to add Cascading Style Sheets (CSS) and JavaScript code to TWiki pages, which can be used to make TWiki application more interactive. To prevent TWiki from interpreting some text as markup, it can be enclosed in HTML-escaped <pre>-tags.

JavaScript Example: CSS Example:
<!-- <pre> -->
<script language="javascript">
<!--
  // put your JavaScript code here
//-->
</script>
<!-- </pre> -->
<!-- <pre> -->
<style type="text/css">
  /* put your CSS code here */
</style>
<!-- </pre> -->

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 GoodStyle topic located in the current web.

  • NotExistingYet is a topic waiting to be written because it is a red-link. Create the topic by clicking on the link. (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.

  • Write [[URL][label]] to get an external link with a descriptive text for the link, such as [[http://google.com/][Google home page]] to get Google home page.

  • E-mail addresses like name@domain.com are linked automatically.

TWiki Variables

TWiki Variables are names enclosed in percent signs that are that are expanded to some other text when the topic is displayed. For example, %TOPIC% is expanded to TWikiVariablesQuickStart. Some variables can take arguments in curly braces - for example, %INCLUDE{"OtherTopic" arg="value"}%.

Many TWiki variables are built-in, and others are predefined for your convenience. TWikiVariables describes how you can also define your own TWiki Variables at the entire site, individual web, or individual topic level. Variables are fully expanded before any of the TWiki text formatting rules are applied.

Commonly used variables:

  • %TOC% : Automatically generates a table of contents based on headings in a topic - see the top of this page for an example.
  • %WEB% : The current web, is TWiki.
  • %TOPIC% : The current topic name, is TWikiVariablesQuickStart.
  • %ATTACHURL% : The attachment URL of the current topic. Example usage: If you attach a file to a topic you can refer to it as %ATTACHURL%/image.gif to show the URL of the file or the image in your text.
  • %INCLUDE{"SomeTopic"}% : Server side include, includes another topic. The current web is the default web. Example: %INCLUDE{"TWiki.SiteMap"}%
  • %SEARCH{"sushi"}% : Inline search showing the search result embedded in a topic. FormattedSearch gives you control over formatting, used to create web-based applications.
  • Documentation Graphics: There are many graphics available to use in your topics. Use %ICON{"help"}%, %ICON{"tip"}%, and %ICON{"warning"}% to get: HELP, TIP, and ALERT!, respectively.
  • Use the TWiki Variables Wizard to find and compose variables.
  • See all TWiki Variables.

Tip, idea To "escape" a variable, prefix it with an exclamation mark. Write: !%SOMEVARIABLE% to get: %SOMEVARIABLE%.

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 Plugins web on TWiki.org.

Currently enabled plugins on this TWiki installation, as listed by %PLUGINDESCRIPTIONS%:

  • SpreadSheetPlugin (2015-06-07, $Rev: 29303 (2015-06-07) $): Add spreadsheet calculation like "$SUM( $ABOVE() )" to TWiki tables or anywhere in topic text
  • ColorPickerPlugin (2015-01-10, $Rev: 28645 (2015-01-11) $): Color picker, packaged for use in TWiki forms and TWiki applications
  • CommentPlugin (2015-01-10, $Rev: 28647 (2015-01-11) $): Quickly post comments to a page without an edit/preview/save cycle
  • DatePickerPlugin (2015-01-10, $Rev: 28649 (2015-01-11) $): Pop-up calendar with date picker, for use in TWiki forms, HTML forms and TWiki plugins
  • EditTablePlugin (2015-01-10, $Rev: 28651 (2015-01-11) $): Edit TWiki tables using edit fields, date pickers and drop down boxes
  • EmbedFlashPlugin (2011-01-11, $Rev: 20177 (2011-01-11) $): Embed Adobe Flash files in TWiki topics
  • FormPlugin (2015-02-25, $Rev: 28764 (2015-02-25) $): Create simple and advanced web forms using TWiki forms
  • GoogleAnalyticsPlugin (2011-05-14, $Rev: 21272 (2011-05-14) $): Adds Google Analytics javascript code to specified pages
  • HeadlinesPlugin (2015-01-10, $Rev: 28655 (2015-01-11) $): Show headline news in TWiki pages based on RSS and ATOM news feeds from external sites
  • ImagePlugin (2010-08-01, $Rev: 19301 (2010-08-01) $): Control the display and alignment of images using an easy syntax
  • InterwikiPlugin (2015-06-18, $Rev: 29369 (2015-06-18) $): Write ExternalSite:Page to link to a page on an external site based on aliases defined in a rules topic
  • JQueryPlugin (2015-01-10, $Rev: 29460 (2015-09-11) $): jQuery JavaScript library for TWiki
  • PreferencesPlugin (2015-01-14, $Rev: 28662 (2015-01-14) $): Allows editing of preferences using fields predefined in a form
  • RenderListPlugin (2015-01-14, $Rev: 28665 (2015-01-14) $): Render bullet lists in a variety of formats
  • SendEmailPlugin (2013-01-24, $Rev: 25975 (2013-05-28) $): Allows to send e-mails through an e-mail form.
  • SetGetPlugin (2015-07-09, $Rev: 29398 (2015-07-09) $): Set and get variables and JSON objects in topics, optionally persistently across topic views
  • SlideShowPlugin (2015-01-14, $Rev: 28669 (2015-01-14) $): Create web based presentations based on topics with headings.
  • SmiliesPlugin (2015-02-16, $Rev: 28708 (2015-02-17) $): Render smilies as icons, like  :-)  as smile or  :eek:  as eek!
  • TWikiNetSkinPlugin: (disabled)
  • TablePlugin (2015-02-16, $Rev: 28722 (2015-02-17) $): Control attributes of tables and sorting of table columns
  • TagMePlugin (2015-02-16, $Rev: 28724 (2015-02-17) $): Tag wiki content collectively or authoritatively to find content by keywords
  • TinyMCEPlugin (2015-02-16, $Rev: 28726 (2015-02-17) $): Integration of the Tiny MCE WYSIWYG Editor
  • TwistyPlugin (2015-04-28, $Rev: 29136 (2015-04-28) $): Twisty section JavaScript library to open/close content dynamically
  • WatchlistPlugin (2015-01-15, $Rev: 28681 (2015-01-15) $): Watch topics of interest and get notified of changes by e-mail
  • WysiwygPlugin (2015-02-16, $Rev: 28737 (2015-02-17) $): Translator framework for WYSIWYG editors

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 '>'.
      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, e.g. '&copy;' is the © copyright character. You need to escape '&' to see it as it is, so write '&amp;' instead of '&'.
      Example: Type 'This &amp; that' to get 'This & that'.

Related topics: WikiSyntax, WikiWord, WikiNotation, TextFormattingRules, TWikiEditingShorthand, TWikiRenderingShortcut, TWikiShorthand, TWikiVariablesQuickStart

Edit | Attach | Watch | Print version | History: r55 < r54 < r53 < r52 < r51 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r55 - 2012-11-15 - TWikiContributor
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TextFormattingRules.