Package io.ktor.html

Types

HtmlContent

class HtmlContent : WriteChannelContent

Represents an OutgoingContent using kotlinx.html builder.

Placeholder

open class Placeholder<TOuter>

A placeholder that is inserted inside TOuter

PlaceholderItem

class PlaceholderItem<TOuter> : Placeholder<TOuter>

Item of a placeholder list when it is expanded

PlaceholderList

open class PlaceholderList<TOuter, TInner>

Placeholder that can appear multiple times

Template

interface Template<in TOuter>

A template that expands inside TOuter

TemplatePlaceholder

open class TemplatePlaceholder<TTemplate>

A placeholder that is also a template

Functions

each

fun <TOuter, TInner> TOuter.each(
    items: PlaceholderList<TOuter, TInner>,
    itemTemplate: TOuter.(PlaceholderItem<TInner>) -> Unit
): Unit

Inserts every element of placeholder list

insert

fun <TOuter> TOuter.insert(
    placeholder: Placeholder<TOuter>
): Unit

Inserts placeholder

fun <TTemplate : Template<TOuter>, TOuter> TOuter.insert(
    template: TTemplate,
    placeholder: TemplatePlaceholder<TTemplate>
): Unit
fun <TOuter, TTemplate : Template<TOuter>> TOuter.insert(
    template: TTemplate,
    build: TTemplate.() -> Unit
): Unit

respondHtml

suspend fun ApplicationCall.respondHtml(
    status: HttpStatusCode = HttpStatusCode.OK,
    block: HTML.() -> Unit
): Unit

Responds to a client with a HTML response, using specified block to build an HTML page

respondHtmlTemplate

suspend fun <TTemplate : Template<HTML>> ApplicationCall.respondHtmlTemplate(
    template: TTemplate,
    status: HttpStatusCode = HttpStatusCode.OK,
    body: TTemplate.() -> Unit
): Unit