---
title: "Format.html ViewHelper <f:format.html>"
manual: "Fluid ViewHelper Reference"
version: "14.3"
permalink: "https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-format-html@14.3"
source: "Global/Format/Html.rst"
rendered: "2026-10-01T16:43:06+00:00"
---

# Format.html ViewHelper `<f:format.html>` {#typo3-fluid-format-html}

<!-- TODO: no Markdown rendering for "versionchanged" -->

The Render.text ViewHelper <f:render.text>
should be used whenever text fields from records are
displayed in HTML output.Depending on the TCA definition of the rendered field nl2br is then
automatically applied for multi line text areas.

ViewHelper to render a string which can contain HTML markup by passing it to a TYPO3 `parseFunc`. This can sanitize unwanted HTML tags and attributes, and keep wanted HTML syntax and take care of link substitution and other parsing. Either specify a path to the TypoScript setting or set the `parseFunc` options directly. By default, `lib.parseFunc_RTE` is used to parse the string.

**Note:** The ViewHelper must not be used in backend context, as it triggers frontend logic. Instead, use `<f:sanitize.html>` within backend context to secure a given HTML string or `<f:transform.html>` to parse links in HTML.

Go to the source code of this ViewHelper: [Format\\HtmlViewHelper.php (GitHub)](https://github.com/TYPO3/typo3/blob/main/typo3/sysext/fluid/Classes/ViewHelpers/Format/HtmlViewHelper.php).

**Table of contents**

-   [Using the <f:format.html> ViewHelper with default arguments](https://docs.typo3.org/permalink/t3viewhelper:using-the-f-format-html-viewhelper-with-default-arguments@14.3)
-   [Arguments of the <f:format.html> ViewHelper](https://docs.typo3.org/permalink/t3viewhelper:arguments-of-the-f-format-html-viewhelper@14.3)

## Using the `<f:format.html>` ViewHelper with default arguments {#typo3-fluid-format-html-example}

**packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html**

```html
<f:format.html>
    {$myConstant.project} is a cool <b>CMS</b>
    (<a href="https://www.typo3.org">TYPO3</a>).
</f:format.html>
```

```html
<p class="bodytext">TYPO3 is a cool <strong>CMS</strong>
(<a href="https://www.typo3.org" target="_blank">TYPO3</a>).</p>
```

The exact output depends on TYPO3 constants.

## Arguments of the `<f:format.html>` ViewHelper {#typo3-fluid-format-html-arguments}

-   **current**

    -   *Type:* string

    Initialize the content object with this value for current property.

-   **currentValueKey**

    -   *Type:* string

    Define the value key, used to locate the current value for the content object

-   **data**

    -   *Type:* mixed

    Initialize the content object with this set of data. Either an array or object.

-   **parseFuncTSPath**

    -   *Type:* string
    -   *Default:* 'lib.parseFunc_RTE'

    Path to the TypoScript parseFunc setup.

-   **table**

    -   *Type:* string
    -   *Default:* ''

    The table name associated with the "data" argument.

### parseFuncTSPath argument: formatting text with a custom parsing function {#typo3-fluid-format-html-parsefunc}

The `parseFuncTSPath` argument specifies which TypoScript `parseFunc`
configuration is used to process the content.

```html
<f:format.html parseFuncTSPath="lib.parseFunc">
    {someText}
</f:format.html>
```

or inline:

```html
{someText -> f:format.html(parseFuncTSPath: 'lib.myParseFunc')}
```

With a custom parsing function defined in TypoScript:

**config/site/mysite/setup.typoscript**

```typoscript
lib.myParseFunc < lib.parseFunc
lib.myParseFunc {
    // replace --- with soft-hyphen
    short.--- = &shy;
}
```

> [!NOTE]
> **See also**
>
> For all options see the
> TypoScript reference, chapter parseFunc.

### Data argument {#typo3-fluid-format-html-arguments-data}

<!-- TODO: no Markdown rendering for "versionchanged" -->

The Render.text ViewHelper <f:render.text>
should be used whenever text fields from records are
displayed in HTML output.Depending on the TCA definition of the rendered field nl2br is then
automatically applied for multi line text areas.

If you use TypoScript properties such as `field` or `dataWrap`,
you should pass structured data
([Data transfer object (DTO)](https://docs.typo3.org/m/typo3/reference-coreapi/14.3/en-us/ExtensionArchitecture/Extbase/Domain/Dto.html#extbase-dto)
or named array) as `data`. This ensures that field references like
`{FIELD:title}` are resolved correctly.

**packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html**

```html
<f:format.html
    data="{someDto}"
    parseFuncTSPath="lib.myParseFunc"
>
    You entered the following in the form:
</f:format.html>
```

You may get the following output:

```html
You entered the following in the form:
<strong>TYPO3, greatest CMS ever</strong>
```

With a custom parsing function defined in TypoScript:

**config/site/mysite/setup.typoscript**

```typoscript
lib.myParseFunc < lib.parseFunc
lib.myParseFunc {
    dataWrap = |<strong>{FIELD:title}</strong>
}
```

### Current argument {#typo3-fluid-format-html-arguments-data-current}

Use the `current` argument to override the current value used by the TypoScript
content object.

**packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html**

```html
<f:format.html
    current="{strContent}"
    parseFuncTSPath="lib.myParseFunc"
>
    I'm gone
</f:format.html>
```

You may get the following output:

```html
Thanks Kasper for this great CMS
```

With the following custom parsing function defined in TypoScript:

**config/site/mysite/setup.typoscript**

```typoscript
lib.myParseFunc < lib.parseFunc
lib.myParseFunc {
    setContentToCurrent = 1
}
```

### CurrentValueKey argument {#typo3-fluid-format-html-arguments-data-currentvaluekey}

Use the `currentValueKey` argument to define a value of data object as the
current value.

**packages/my_extension/Resources/Private/Templates/Content/Text.fluid.html**

```html
<f:format.html
    data="{someDto}"
    currentValueKey="header"
    parseFuncTSPath="lib.content"
>
    Content:
</f:format.html>
```

You may get the following output:

```html
Content: How to install TYPO3 in under 2 minutes ;-)
```

With the following custom parsing function defined in TypoScript:

**config/site/mysite/setup.typoscript**

```typoscript
lib.myParseFunc < lib.parseFunc
lib.myParseFunc {
    dataWrap = |{CURRENT:1}
}
```
