{text2html:text:type}

Description

Converts a plain-text string into HTML. In the default mode it does three things: it HTML-escapes the text (so a less-than sign becomes the entity and the result is safe to drop into a page), it turns bare http and https URLs and e-mail addresses into clickable links (e-mail addresses get a mailto link with the at-sign obfuscated), it converts newlines to line breaks, and a double space becomes a wide space. Pass the second parameter as CZHTML to switch to Czech typography mode instead: it does NOT escape or linkify, it only inserts non-breaking spaces after Czech one-letter prepositions (a, i, o, s, z, k, v and their capitals) and before units and after common abbreviations and academic titles, leaving any HTML tags in the text untouched. The command was written mainly to build the HTML body of e-mails sent by the mail commands from a text field. It does not trim its input. With an empty first parameter it returns an empty string.

Parameters

text required default (empty)

The plain-text string to convert. In default mode it is HTML-escaped, its URLs and e-mail addresses are linkified, and its newlines become line breaks. In CZHTML mode it is left as-is except for non-breaking-space typography. The text is not trimmed. An empty value yields an empty result.

type optional default (empty = default mode)

Conversion mode. Leave empty (the default) for the standard escape-plus-linkify-plus-line-breaks conversion. Set it to CZHTML to apply Czech non-breaking-space typography (one-letter prepositions, units, abbreviations, titles) without escaping or linkifying. Any other value behaves like the empty default.

Examples

test[{text2html:Vyrocni zprava 2025}]
Expected[Vyrocni zprava 2025]
Actual[Vyrocni zprava 2025]
Text with no special characters, URLs or line breaks is returned unchanged (still HTML-safe). The brackets show there is no added whitespace.
test[{text2html:Cena 100 < 200}]
Expected[Cena 100 < 200]
Actual[Cena 100 < 200]
Like {safe:}, default mode escapes HTML so the text is safe to print. The less-than sign becomes its entity, shown here as the literal characters.
test[{text2html:Veda & vyzkum}]
Expected[Veda & vyzkum]
Actual[Veda & vyzkum]
An ampersand in the text is escaped to its entity so it is valid HTML.
test{text2html:See https://apc.org today}
ExpectedSee apc.org today
apc.org today">ActualSee apc.org today
A bare http or https URL becomes a clickable anchor. The link text is the domain and path (without the scheme); the href keeps the full URL.
test{text2html:Write to info@apc.org please}
ExpectedWrite to info@apc.org please
info@apc.org please">ActualWrite to info@apc.org please
A bare e-mail address becomes a mailto link. The at-sign is replaced by its numeric entity (cheap obfuscation against address harvesters).
test{text2html:Line one Line two}
ExpectedLine one
Line two
ActualLine one
Line two
A newline in the source text becomes an HTML line break, so multi-line text fields keep their layout when shown as HTML.
test[{text2html:two spaces}]
Expected[two  spaces]
Actual[two  spaces]
Two consecutive spaces collapse in HTML, so default mode replaces a double space with a normal space plus a wide en-space, preserving the visible gap.
test[{text2html:Klub a spolek:CZHTML}]
Expected[Klub a spolek]
Actual[Klub a spolek]
With the second parameter CZHTML the command does not escape or linkify; it only adds Czech typography. Here the one-letter preposition a is glued to the next word with a non-breaking space.
test[{text2html:}]
Expected[]
Actual[]
An empty first parameter returns an empty string (the brackets in the output touch).