---
title: "Format.html ViewHelper <f:format.html>"
manual: "Fluid ViewHelper Reference"
version: "main"
permalink: "https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-format-html@main"
source: "Global/Format/Html.rst"
modified: "2026-09-17T05:12:06+00:00"
---

# Format.html ViewHelper `<f:format.html>`

> [!NOTE]
> **Changed in version 14.0**
>
> The [Render.text ViewHelper \<f:render.text>](https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-render-text@main)
> 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@main)
-   [Arguments of the <f:format.html> ViewHelper](https://docs.typo3.org/permalink/t3viewhelper:arguments-of-the-f-format-html-viewhelper@main)

## Using the `<f:format.html>` ViewHelper with default arguments

**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

-   **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

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](https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Parsefunc.html#parsefunc).

### Data argument

> [!NOTE]
> **Changed in version 14.0**
>
> The [Render.text ViewHelper \<f:render.text>](https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-render-text@main)
> 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/main/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

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

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}
}
```
