{protectmail:email:text}

Description

Hides an email address inside client-side JavaScript so spambots that scrape the page source never see a plain mailto address, while a human visitor still gets a normal clickable email link. On render the command emits an empty anchor tag plus a small script that assembles the mailto target and the visible link text in the browser at load time. The first parameter is the address to protect. The optional second parameter is the visible link text; if you omit it, the address itself is shown. If the first parameter is empty the command returns just the second parameter unchanged (or nothing). Because the markup is built in JavaScript, the link is invisible to visitors with JavaScript disabled and to plain-text or feed renderers. The output is never cached and embeds a random element id, so the exact HTML differs on every render - useful examples are illustrative rather than asserted.

Parameters

email required

The e-mail address to protect, for example studio@example.org. It is split on the @ sign and reassembled in JavaScript so it never appears whole in the page source. If this is empty the command outputs only the text parameter.

text optional default the email address

The visible link text. If omitted, the protected e-mail address is shown as the link text. The text is escaped for JavaScript before being inserted, so quotes and angle brackets are safe.

Examples

virtual{protectmail:studio@example.org:Write to us}
Expected
">Actual
Pass a second parameter to set the visible link text. The script inserts Write to us as the anchor text while the mailto target stays studio@example.org. The text is JavaScript-escaped, so quotes and angle brackets are safe.
test[{protectmail:}]
Expected[]
Actual[]
With no address and no text the command outputs an empty string. The surrounding brackets show that the result is genuinely empty.
test{protectmail::fallback}
Expectedfallback
Actualfallback
Edge case worth knowing: when the first parameter (the address) is empty, no link is built - the command returns the second parameter verbatim. Here that is the literal fallback.
virtualE: {protectmail:studio@example.org} - T: 224 319 860
ExpectedE: - T: 224 319 860
- T: 224 319 860">ActualE: - T: 224 319 860
How it appears in a page footer or contact block: the protected link sits inline with other text. This mirrors live production use, where the address is shielded but the visitor still sees E: studio@example.org as a clickable mailto link.
virtual{protectmail:studio@example.org}
Expected
">Actual
The most common use: pass just the address. AA outputs an empty anchor plus a script that builds the mailto link in the browser, with the address itself as the visible text. The element id (aapm...) is random on every render, so this is illustrative, not asserted.