copyAsHtml5

fun StyledDocument.copyAsHtml5(start: Int, pastEnd: Int, codeBackground: Color = SystemColors.active.codeBackground): String

Copy the specified range from the receiver as a fragment of HTML5 text. Embed the style attributes directly into the HTML, using style rather than class attributes to keep the fragment portable and document-independent.

The primary use case for this method is embedding authentic styled Avail code into larger HTML5 documents, e.g., the official Avail documentation, promotional material for Avail, blog posts, etc.

Receiver

The StyledDocument from which the desired HTML5 should be abstracted.

Return

The requested HTML5 fragment.

Parameters

start

The start of the range to abstract.

pastEnd

The position just past the end of the range to abstract.

codeBackground

The background color to use for the whole fragment.