This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

ViewWidget

19th December 2021 at 9:34pm

Introduction

The view widget displays the contents of a tiddler field in a specified format.

Content and Attributes

The content of the <$view> widget is displayed if the field or property is missing or empty.

AttributeDescription
tiddlerThe title of the tiddler (defaults to the current tiddler)
fieldThe name of the field to view (defaults to "text")
indexThe name of the index to view
formatThe format for displaying the field (see below)
templateOptional template string used when the format attribute is set to "date"
subtiddlerOptional SubTiddler title when the target tiddler is a plugin (see below)
modeIntroduced in v5.1.15 Optional transclusion parsing mode for wikified formats. May be "inline" or "block" (the default)

Formats

The following formats can be specified in the format attribute:

FormatDescription
textPlain text (default)
Tip
See also the TextWidget. <$view format=text tiddler=MyTiddler/> renders the same as <$text text={{MyTiddler}}/>
htmlencodedThe field is displayed with HTML encoding.
Tip
Rendered value is the same as the output from the encodehtml filter operator
htmltextencodedIntroduced in v5.2.0 The field is displayed with HTML encoding, only double quotes (") are not escaped. This creates a more compact htmlencoding appropriate for html text content, but not for attributes.
urlencodedThe field is displayed with URL encoding
Tip
Rendered value is the same as the output from the encodeuri filter operator
doubleurlencodedThe field is displayed with double URL encoding
Tip
Rendered value is the same as the output from calling the encodeuri filter operator twice
htmlwikifiedThe field is wikified according to the mode attribute and the resulting HTML returned as plain text (ie HTML elements will appear in plain text)
plainwikifiedThe field is wikified according to the mode attribute and the text content of the resulting HTML returned as plain text (ie HTML elements will be removed)
htmlencodedplainwikifiedThe field is wikified according to the mode attribute and the text content of the resulting HTML returned as HTML encoded plain text (ie HTML elements will be removed)
dateThe field is interpreted as a UTC date and displayed according to the DateFormat specified in the template attribute
Tip
Rendered value is the same as the output from the format:date filter operator
relativedateThe field is interpreted as a UTC date and displayed as the interval from the present instant
Tip
Rendered value is the same as the output from the format:relativedate filter operator
stripcommentsThe field is interpreted as JavaScript source code and any lines beginning \\# are stripped
jsencodedThe field is displayed as a JavaScript encoded string
Tip
Rendered value is the same as the output from the stringify filter operator

"WikiText format"

To display the field content as regular WikiText, for example with working links, use the TranscludeWidget instead.

SubTiddler Access

The view widget allows access to the individual tiddlers stored within a plugin.

The following example will view the core version of the tiddler $:/DefaultTiddlers even if it has been overridden:


<$view tiddler="$:/core" subtiddler="$:/DefaultTiddlers"/>

That renders as:

GettingStarted

Examples

Given this Saturday example tiddler:

tiddlerraw contentrendered content
Saturday<<.this-is-operator-example>> This example tiddler is used to illustrate some of the Filter Operators.

Here is how <$view tiddler=Saturday format=<<format>>/> renders for each format:

formatrenders as
text <<.this-is-operator-example>>
htmlencoded &lt;&lt;.this-is-operator-example&gt;&gt;
htmltextencoded &lt;&lt;.this-is-operator-example&gt;&gt;
urlencoded %3C%3C.this-is-operator-example%3E%3E%0A
doubleurlencoded %253C%253C.this-is-operator-example%253E%253E%250A
htmlwikified <p>This example tiddler is used to illustrate some of the <a class="tc-tiddlylink tc-tiddlylink-resolves" href="Filter%2520Operators.html">Filter Operators</a>.</p>
plainwikified This example tiddler is used to illustrate some of the Filter Operators.
htmlencodedplainwikified This example tiddler is used to illustrate some of the Filter Operators.
stripcomments <<.this-is-operator-example>>
jsencoded <<.this-is-operator-example>>\n