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
textstringrequiredText to convert
text2stringoptionalMultiple texts may be passed.
...stringoptionalAdditional 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`));
}#The template above produces this output:
Convert to link:
<a href="http://www.docly.net" title="Click to open in a new window or tab" target="_blank">www.docly.net</a>
Convert multiple lines to br tags:
Line one<br /> Line two<br /> Line three