mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-27 10:30:28 +00:00
7108e0d861
Fixes #2624
89 lines
2.4 KiB
Plaintext
89 lines
2.4 KiB
Plaintext
caption: HTML
|
|
created: 20131205160816081
|
|
modified: 20161021102422842
|
|
tags: WikiText
|
|
title: HTML in WikiText
|
|
type: text/vnd.tiddlywiki
|
|
|
|
HTML tags and comments can be used directly in WikiText. For example:
|
|
|
|
```
|
|
<article class="hello">
|
|
This is my nice and simple block of text. HelloThere
|
|
<!-- This comment will not appear in the wikified output -->
|
|
</article>
|
|
```
|
|
|
|
[[Widgets share the same syntax as HTML tags|Widgets in WikiText]], and so the following information applies to them, too.
|
|
|
|
! Content Parsing
|
|
|
|
The content of an HTML element will be parsed in inline mode unless the opening tag is followed by two linebreaks, in which case it will be parsed in block mode. (Inline mode means that block mode formatting such as tables, lists and headings is not recognised).
|
|
|
|
! Attributes
|
|
|
|
In an extension of conventional HTML syntax, attributes of elements/widgets can be specified in several different ways:
|
|
|
|
* a literal string
|
|
* a transclusion of a TextReference
|
|
* a transclusion of a [[macro/variable|Macros in WikiText]]
|
|
* as the result of a [[Filter Expression]]
|
|
|
|
!! Literal Attribute Values
|
|
|
|
Literal attribute values can use several different styles of quoting:
|
|
|
|
* Single quotes (eg `attr='value'`)
|
|
* Double quotes (eg `attr="value"`)
|
|
* Tripe double quotes (eg `attr="""value"""`)
|
|
* No quoting is necessary for values that do not contain spaces (eg `attr=value`)
|
|
|
|
Literal attribute values can include line breaks. For example:
|
|
|
|
```
|
|
<div data-address="Mouse House,
|
|
Mouse Lane,
|
|
Rodentville,
|
|
Ratland."/>
|
|
```
|
|
|
|
By using triple-double quotes you can specify attribute values that contain single double quotes. For example:
|
|
|
|
```
|
|
<div data-address="""Mouse House,
|
|
"Mouse" Lane,
|
|
Rodentville,
|
|
Ratland."""/>
|
|
```
|
|
|
|
!! Transcluded Attribute Values
|
|
|
|
Transcluded attribute values are indicated with double curly braces around a TextReference. For example:
|
|
|
|
```
|
|
attr={{tiddler}}
|
|
attr={{!!field}}
|
|
attr={{tiddler!!field}}
|
|
```
|
|
|
|
!! Variable Attribute Values
|
|
|
|
Variable attribute values are indicated with double angle brackets around a [[macro invocation|Macro Calls in WikiText]]. For example:
|
|
|
|
```
|
|
<div title=<<MyMacro "Brian">>>
|
|
...
|
|
</div>
|
|
```
|
|
|
|
!! Filtered Attribute Values
|
|
|
|
Filtered attribute values are indicated with triple curly braces around a [[Filter Expression]]. The value will be the first item in the resulting list, or the empty string if the list is empty.
|
|
|
|
This example shows how to add a prefix to a value:
|
|
|
|
```
|
|
<$text text={{{ [<currentTiddler>]addPrefix[$:/myprefix/]] }}}>
|
|
```
|
|
|