You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -12,42 +12,99 @@ UFM is built on top of [GitHub Flavored Markdown](https://github.github.com/gfm/
12
12
13
13
## Syntax
14
14
15
-
The essence of the UFM syntax is curly brackets with a marker prefix.
15
+
The essence of the UFM syntax is curly brackets with an alias prefix delimited with a colon.
16
16
17
17
```markdown
18
-
{<marker prefix> <contents>}
18
+
{<alias prefix>: <contents>}
19
19
```
20
20
21
21
For clarity...
22
22
23
-
- The opening is `{` U+007B Left Curly Bracket
24
-
- The closing is `}` U+007D Right Curly Bracket
25
-
-The marker prefix can be any valid Unicode character(s), including emojis
23
+
- The opening token is `{` U+007B Left Curly Bracket
24
+
- The alias prefix can be any valid Unicode character(s), including emojis
25
+
-Followed by `:` U+003A Colon, (not part of the alias prefix itself)
26
26
- The contents within the curly brackets can include any Unicode characters, including whitespace
27
+
- The closing token is `}` U+007D Right Curly Bracket
27
28
28
-
An example of this syntax to render a value of a property by its alias is: `{= bodyText}`.
29
+
An example of this syntax to render a value of a property by its alias is: `{umbValue: bodyText}`.
29
30
30
-
The curly brackets indicate that the UFM syntax should be processed. The `=` marker prefix indicates which UFM component should be rendered, and the `bodyText` contents are the parameter that is passed to that UFM component.
31
+
The curly brackets indicate that the UFM syntax should be processed. The `umbValue` alias prefix indicates which UFM component should be rendered, and the `bodyText` contents are the parameter that is passed to that UFM component.
31
32
32
-
With this example, the syntax `{= bodyText}` would be processed and rendered as the following markup:
33
+
With this example, the syntax `{umbValue: bodyText}` would be processed and rendered as the following markup:
The internal working of the `ufm-label-value` component would then be able to access the property's value using the [Context API](../extending/backoffice-setup/working-with-data/context-api).
39
40
40
-
## Available UFM components
41
41
42
-
As for Umbraco 14.1.0, the following UFM components are available to use.
42
+
### Filters
43
43
44
-
| Name | Marker | Example syntax | Renders component |
In addition, a filter syntax can be applied to UFM contents. This can be useful for formatting or transforming a value without needing to develop your own custom UFM component.
45
+
46
+
The syntax for UFM filters uses a pipe character `|` (U+007C Vertical Line). Multiple filters may be applied, and the value from the previous filter is passed onto the next.
47
+
48
+
To display a rich text value, stripping out the HTML markup and limiting it to the first 15 words could use the following filters:
| Word Limit |`word-limit`| `{umbValue: intro | word-limit:15}` |
64
+
65
+
66
+
## UFM components
67
+
68
+
### Available UFM components
69
+
70
+
The following UFM components are available to use.
71
+
72
+
- Label Value
73
+
- Localize
74
+
- Content Name
48
75
49
76
More UFM components will be available in upcoming Umbraco releases.
50
77
78
+
79
+
#### Label Value
80
+
81
+
The Label Value component will render the current value of a given property alias.
82
+
83
+
The alias prefix is `umbValue`. An example of the syntax is `{umbValue: bodyText}`, which would render the component as `<ufm-label-value alias="bodyText"></ufm-label-value>`.
84
+
85
+
For brevity and backwards-compatibility, the `=` marker prefix can be used, e.g. `{=bodyText}`.
86
+
87
+
88
+
#### Localize
89
+
90
+
The Localize component will render a localization for a given term key.
91
+
92
+
The alias prefix is `umbLocalize`. An example of the syntax is `{umbLocalize: general_name}`, which would render the component as `<ufm-localize alias="general_name"></ufm-localize>`.
93
+
94
+
Similarly, for brevity and backwards-compatibility, the `#` marker prefix can be used, e.g. `{#general_name}`.
95
+
96
+
97
+
#### Content Name
98
+
99
+
The Content Name component will render the name of a content item, (either Document, Media or Member), from the value of a given property alias. Multiple values will render the names as a comma-separated list.
100
+
101
+
The alias prefix is `umbContentName` An example of the syntax is `{umbContentName: pickerAlias}`, which would render the component as `<ufm-content-name alias="pickerAlias"></ufm-content-name>`.
102
+
103
+
The Content Name component supports content-based pickers, such as the Document Picker, Content Picker (formerly known as Multinode Treepicker), and Member Picker. Support for the advanced Media Picker will be available in an upcoming Umbraco release.
104
+
105
+
106
+
### Custom UFM components
107
+
51
108
If you wish to develop your own custom UFM component, you can use the `ufmComponent` extension type:
52
109
53
110
```json
@@ -57,14 +114,16 @@ If you wish to develop your own custom UFM component, you can use the `ufmCompon
// You could do further regular expression/text processing here!
@@ -75,7 +134,41 @@ export class MyCustomUfmComponentApi implements UmbUfmComponentBase {
75
134
export { MyCustomUfmComponentApiasapi };
76
135
```
77
136
78
-
Using the syntax `{% myCustomText }` would render the markup `<ufm-custom-component text="myCustomText">`. Then inside the `ufm-custom-component` component code, you can perform any logic to render your required markup.
137
+
Using the `{myCustom: myCustomText}` syntax would render the following markup: `<ufm-custom-component text="myCustomText"></ufm-custom-component>`. Inside the `ufm-custom-component` component code, you can perform any logic to render your required markup.
138
+
139
+
140
+
### Custom UFM filters
141
+
142
+
If you wish to develop custom UFM filter, you can use the `ufmFilter` extension type:
143
+
144
+
```json
145
+
{
146
+
type: 'ufmFilter',
147
+
alias: 'My.UfmFilter.Reverse',
148
+
name: 'Reverse UFM Filter',
149
+
api: () => import('./reverse.filter.js'),
150
+
meta: {
151
+
alias: 'reverse'
152
+
}
153
+
}
154
+
```
155
+
156
+
The corresponding JavaScript/TypeScript API would contain a function to transform the value.
0 commit comments