Docly Developers
Function Updated 17 Oct 2026

textToHtml(text)

Converts plain text to HTML: encodes characters like < and &, turns line breaks (
) into <br> tags and makes URLs clickable. Several arguments are joined.

Parameters

textstringrequired

Text to convert to HTML.

Returns

String with encoded characters, <br> for each line break (
) and links for URLs. A carriage return alone (
, chr(13)) is not a line break here.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
    var text = "Hello" + chr(10) + "world!";   // chr(10) = 

    var html = docly.textToHtml(text);
    write(html);   // Hello, a <br> tag, world!
}#