mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-08-23 18:16:44 +00:00
42 lines
1.4 KiB
Plaintext
42 lines
1.4 KiB
Plaintext
title: LinkWidget
|
|
tags: widget
|
|
|
|
The `link` widget generates links to tiddlers.
|
|
|
|
! Content and Attributes
|
|
|
|
|!Attribute |!Description |
|
|
|to |The title of the target tiddler for the link (defaults to the [[WidgetVariable: currentTiddler]]) |
|
|
|
|
The content of the link widget is rendered within the `<a>` tag.
|
|
|
|
! CSS Classes
|
|
|
|
* `tw-tiddlylink` - applied to all links
|
|
* `tw-tiddlylink-external` - applied to external, non-tiddler links
|
|
* `tw-tiddlylink-internal` - applied to tiddler links
|
|
* `tw-tiddlylink-missing` - applied to tiddler links where the target tiddler doesn't exist
|
|
* `tw-tiddlylink-resolves` - applied to tiddler links when the target tiddler does exist
|
|
|
|
! Configuration macros
|
|
|
|
Configuration macros can be used to modify the behaviour of the link widget.
|
|
|
|
!! tw-wikilinks
|
|
|
|
Links are suppressed if the macro `tw-wikilinks` evaluates to the string `no`. For example:
|
|
|
|
```
|
|
\define tw-wikilinks() no
|
|
```
|
|
|
|
!! tw-wikilink-template
|
|
|
|
Link targets default to the URL encoded title of the tiddler. The `href` can be templated by defining the configuration macro `tw-wikilink-template`, and including within it the token `$uri_encoded$`. For example:
|
|
|
|
```
|
|
\define tw-wikilink-template() http://tiddlywiki.com/#$uri_encoded$
|
|
```
|
|
|
|
Note that in the browser the `<a>` element generated by the link widget has a JavaScript event handler that navigates directly to the target tiddler, ignoring the `href` attribute.
|