1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-28 12:29:56 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/concepts/WikiText.tid

294 lines
7.0 KiB
Plaintext
Raw Normal View History

tags: concepts
2013-05-01 15:34:06 +00:00
type: text/vnd.tiddlywiki
title: WikiText
modified: 201305011529
\define wikitext-example(src)
```
$src$
```
Renders as:
$src$
In HTML:
$$$text/vnd.tiddlywiki>text/html
$src$
$$$
\end
2012-12-13 21:30:50 +00:00
WikiText is a concise, expressive way of typing a wide range of text formatting, hypertext and interactive features. It allows you to focus on writing without a complex user interface getting in the way. It is designed to be familiar for users of [[MarkDown|http://daringfireball.net/projects/markdown/]], but with more of a focus on linking and the interactive features.
2012-06-22 14:12:42 +00:00
! Linking in WikiText
2012-06-19 07:56:45 +00:00
2012-06-22 14:12:42 +00:00
A key capability of WikiText is the ability to make links to other tiddlers or to external websites. There are several ways of doing this:
2012-06-21 14:38:01 +00:00
2012-06-22 14:12:42 +00:00
* To link to a tiddler by title: `[[Tiddler Title]]`
2012-12-28 22:57:35 +00:00
* To link to a tiddler and specify the text of the link: `[[Displayed Link Title|Tiddler Title]]`
2012-06-22 14:12:42 +00:00
* For tiddler titles that match the CamelCase rules, just typing the title will automatically create a link
* To link to an external website, type the full URL of the site: `http://five.tiddlywiki.com/`
2012-06-22 14:12:42 +00:00
You can suppress a link from being recognised by preceding it with `~`. For example:
<<wikitext-example src:"* ~HelloThere is not a link
* ~http://google.com/ is not a link">>
2012-06-22 14:12:42 +00:00
! Paragraphs
To mark the end of a paragraph in TiddlyWiki you need to type `enter` twice to create a double line break:
2012-12-28 22:57:35 +00:00
```
2012-06-22 14:12:42 +00:00
This is the first paragraph.
And this is the second paragraph.
2012-12-28 22:57:35 +00:00
```
2012-06-22 14:12:42 +00:00
Single line breaks are ignored within paragraphs. For example:
<<wikitext-example src:"This is a
2012-06-22 14:12:42 +00:00
paragraph made
up of
short lines">>
2012-06-22 14:12:42 +00:00
! Formatting
Available character formatting includes:
2012-12-28 22:57:35 +00:00
* <code>&#96;backticks&#96;</code> for `code`
2012-06-22 14:12:42 +00:00
* `''bold''` for ''bold text''
* `//italic//` for //italic text//
* `__underscore__` for __underscored text__
* `^^superscript^^` for ^^superscript^^ text
2012-12-28 22:57:35 +00:00
* `,,subscript,,` for ,,subscripted,, text
* `~~strikethrough~~` for ~~strikethrough~~ text
2012-06-22 14:12:42 +00:00
2012-12-28 22:57:35 +00:00
You can also use triple backticks <code>&#96;&#96;&#96;</code> to mark code blocks:
2012-06-22 14:12:42 +00:00
2012-12-28 22:57:35 +00:00
<pre>
&#96;&#96;&#96;
This will be monospaced
&#96;&#96;&#96;
</pre>
Renders as:
```
This will be monospaced
```
2012-06-22 14:12:42 +00:00
! Transclusion
You can incorporate the content of one tiddler within another using the transclusion notation:
2012-12-28 22:57:35 +00:00
* `{{MyTiddler}}` transcludes a single tiddler
* `{{MyTiddler|tooltip}}` adds a tooltip
* `{{MyTiddler||TemplateTitle}}` displays the tiddler through a specified [[TiddlerTemplate|TiddlerTemplates]]
* `{{MyTiddler|tooltip||TemplateTitle}}` specifies both a tooltip and a template for the transcluded content
* `{{MyTiddler}width:40;height:50;}.firstClass.secondClass` transcludes a single tiddler, adding the specified styles and classes to the transcluded content
A similar syntax can be used to transclude a list of tiddlers matching a specified [[TiddlerFilter|TiddlerFilters]]:
```
{{{ [tag[mechanism]] }}}
{{{ [tag[mechanism]] |tooltip}}}
{{{ [tag[mechanism]] ||TemplateTitle}}}
{{{ [tag[mechanism]] |tooltip||TemplateTitle}}}
{{{ [tag[mechanism]] }}width:40;height:50;}.class.class
2012-12-28 22:57:35 +00:00
```
! Images
To display an image stored in a tiddler just transclude that tiddler:
2012-12-28 22:57:35 +00:00
```
{{Motovun Jack.jpg}}
```
Renders as:
{{Motovun Jack.jpg}}
2012-06-22 14:12:42 +00:00
! Lists
2012-06-22 14:12:42 +00:00
You can create unordered lists with `*` characters:
<<wikitext-example src:"* First list item
2012-06-22 14:12:42 +00:00
* Second list item
** A subitem
* Third list item
">>
2012-06-22 14:12:42 +00:00
Ordered lists use `#` instead of `*`:
2012-06-05 15:33:35 +00:00
2012-06-22 14:12:42 +00:00
# First item
# Second item
# Third item
You can also mix ordered and unordered list items:
<<wikitext-example src:"* To do today
2012-06-22 14:12:42 +00:00
*# Eat
* To get someone else to do
*# This
*# That
*## And the other
">>
2012-06-05 13:41:43 +00:00
2012-06-22 14:12:42 +00:00
You can also create HTML definition lists:
2012-06-05 13:41:43 +00:00
<<wikitext-example src:"; Term being defined
2012-06-22 14:12:42 +00:00
: Definition of that term
; Another term
: Another definition
">>
2012-12-28 22:57:35 +00:00
! Adding styles and classes
2012-12-28 22:57:35 +00:00
You can use this construction to cause the wrapped content to be assigned specified CSS classes or styles:
<<wikitext-example src:"@@.myStyle
2012-12-28 22:57:35 +00:00
* List One
2013-05-01 15:34:06 +00:00
* List Two
2012-12-28 22:57:35 +00:00
@@
">>
2012-12-28 22:57:35 +00:00
Similar syntax is used to assign styles. For example:
<<wikitext-example src:"@@background-color:red;
2012-12-28 22:57:35 +00:00
* List One
2013-05-01 15:34:06 +00:00
* List Two
2012-12-28 22:57:35 +00:00
@@
">>
2012-12-28 22:57:35 +00:00
Multiple styles and classes can be mixed. For example:
2013-05-01 15:34:06 +00:00
<<wikitext-example src:"@@.tw-tiddler-frame
2012-12-28 22:57:35 +00:00
@@width:400px;
Some text
@@
">>
2012-06-22 14:12:42 +00:00
You can also assign a CSS class to an individual member of a list with this notation:
<<wikitext-example src:"* List One
2012-11-29 17:23:46 +00:00
*.MyClass List Two
2012-06-22 14:12:42 +00:00
* List Three
">>
2012-06-22 14:12:42 +00:00
! Typographic Features
2012-06-22 14:12:42 +00:00
You can create an n-dash with a double hyphen `--` and an m-dash with a triple hyphen `---`. For example -- this is an example --- and so is this
You can include a horizontal rule with three or more dashes on their own on a line:
<<wikitext-example src:"
---
">>
2013-03-12 19:00:42 +00:00
! Macros
Macros are snippets of text that can be inserted with a concise shortcut. A macro is defined like this:
```
\define mysamplemacro(name:"Bugs Bunny",address:"Rabbit Hole Hill")
Hi, I'm $name$ and I live in $address$
\end
```
The first line of the definition specifies the macro name and any parameters. Parameters are named and can optionally have default values that are used if the parameter isn't specified at the time of calling. The body of the macro definition follows, terminated with `\end`. The macro can include parameters using the `$name$` construction.
Macro definitions must be placed at the top of a tiddler. Macros are available to the tiddler that defines them, plus any tiddlers that it transcludes.
Macros are used like this:
```
<<mysamplemacro>>
<<mysamplemacro "Donald Duck">>
<<mysamplemacro "Mickey Mouse" "Mouse House">>
```
Resulting in:
```
Hi I'm Bugs Bunny and I live in Rabbit Hole Hill
Hi I'm Donald Duck and I live in Rabbit Hole Hill
Hi I'm Mickey Mouse and I live in Mouse House
```
2012-06-22 14:12:42 +00:00
! HTML in WikiText
2012-08-02 21:16:02 +00:00
HTML tags and comments can be used directly in WikiText. For example:
2012-06-22 14:12:42 +00:00
2012-12-28 22:57:35 +00:00
```
<article class="hello">
This is my nice and simple block of text. HelloThere
2012-08-02 21:16:02 +00:00
<!-- This comment will not appear in the wikified output -->
</article>
2012-12-28 22:57:35 +00:00
```
Attributes in HTML tags can be specified as a transclusion or a macro invocation. For example, here the value of the `href` attribute will be set to the value of the tiddler MyLinkDestination:
```
<a href={{MyLinkDestination}}>link</a>
```
Here an attribute is specified as a macro invocation:
```
<a href=<<MyMacro "Brian">>>link</a>
```
* As a macro invocation
2012-12-28 22:57:35 +00:00
! Widgets
2013-01-03 16:28:07 +00:00
Widgets provide rich functionality within WikiText. For example, the `<$video>` widget can be used to embed videos from YouTube, Vimeo or the Internet Archive:
2012-12-28 22:57:35 +00:00
```
2013-01-03 16:28:07 +00:00
<$video src="32001208" type="vimeo" />
2012-12-28 22:57:35 +00:00
```
2012-12-28 22:57:35 +00:00
For full details of the available widgets, see the [[Docs]].
2012-06-22 14:12:42 +00:00
! Headings
2012-06-22 14:12:42 +00:00
Headings are specified with one or more leading `!` characters:
2012-12-28 22:57:35 +00:00
```
2012-06-22 14:12:42 +00:00
! This is a level 1 heading
!! This is a level 2 heading
!!! This is a level 3 heading
2012-12-28 22:57:35 +00:00
```
CSS classes can be assigned to individual headings like this:
```
!.myStyle This heading has the class `myStyle`
```
2012-06-22 14:45:32 +00:00
! Other WikiText features
!! Typed Blocks
You can incorporate text of a different type within blocks of WikiText. For example:
2012-12-28 22:57:35 +00:00
```
2012-06-22 14:45:32 +00:00
$$$.js
return 2 + "string";
$$$
2012-12-28 22:57:35 +00:00
```
2012-06-22 14:45:32 +00:00
Renders as:
$$$.js
return 2 + "string";
$$$
See TypedBlockWikiText for more details