Docly Developers
Function Updated 17 Oct 2026

toHtml(text, [text2], [...])

Converts multi-line plain text to HTML: encodes HTML characters (like htmlEncode), turns line breaks into <br /> and URLs into links. Line breaks at the start and end of the text are removed. Several arguments are converted and joined.

Parameters

textstringrequired

Text to convert

text2stringoptional

Multiple texts may be passed.

...stringoptional

Additional texts to convert.

Returns

A converted string.

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
Convert to link:
#docly.toHtml("www.docly.net")#


Convert multiple lines to br tags:
#{
    write(docly.toHtml(`Line one
        Line two
        Line three`)); 
}#