# HtmlKt

Added in 1.1.0

*** ** * ** ***


```
public final class HtmlKt
```

<br />

*** ** * ** ***

## Summary

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/text/Spanned.html` | `https://developer.android.com/reference/androidx/core/text/HtmlKt#(kotlin.String).parseAsHtml(kotlin.Int,android.text.Html.ImageGetter,android.text.Html.TagHandler)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html receiver, int flags, https://developer.android.com/reference/android/text/Html.ImageGetter.html imageGetter, https://developer.android.com/reference/android/text/Html.TagHandler.html tagHandler )` Returns a `https://developer.android.com/reference/android/text/Spanned.html` from parsing this string as HTML. |
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/core/text/HtmlKt#(android.text.Spanned).toHtml(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/text/Spanned.html receiver, int option)` Returns a string of HTML from the spans in this `https://developer.android.com/reference/android/text/Spanned.html`. |

## Public methods

### parseAsHtml

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/text/Html.kt+function:parseAsHtml) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final @NonNull Spanned parseAsHtml(
    @NonNull String receiver,
    int flags,
    Html.ImageGetter imageGetter,
    Html.TagHandler tagHandler
)
```

Returns a `https://developer.android.com/reference/android/text/Spanned.html` from parsing this string as HTML.

| Parameters |
|---|---|
| `int flags` | Additional option to set the behavior of the HTML parsing. Default is set to `https://developer.android.com/reference/android/text/Html.html#FROM_HTML_MODE_LEGACY` which was introduced in API 24. |
| `https://developer.android.com/reference/android/text/Html.ImageGetter.html imageGetter` | Returns displayable styled text from the provided HTML string. |
| `https://developer.android.com/reference/android/text/Html.TagHandler.html tagHandler` | Notified when HTML tags are encountered a tag the parser does not know how to interpret. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/text/Html.html#fromHtml(java.lang.String)` |   |

### toHtml

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/text/Html.kt+function:toHtml) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public static final @NonNull String toHtml(@NonNull Spanned receiver, int option)
```

Returns a string of HTML from the spans in this `https://developer.android.com/reference/android/text/Spanned.html`.

| See also |
|---|---|
| `https://developer.android.com/reference/android/text/Html.html#toHtml(android.text.Spanned)` |   |