Overview
The Effect Markup Converter component transforms raw effect markup into sanitized HTML by replacing custom tokens {text;type;value} with styled elements. Each token type maps to a specific visual component - links, badges, or icons. All non-token text can be either regular HTML and CSS or plain text.
Text-Level Semantic HTML Elements
To style the markup beyond plain text, we recommend using text-level semantic HTML elements.
Usage Example
Below is an example of the Effect Markup Converter component in action
Effect Markup (What the editor enters into the Effect field)
Token Syntax
In general, tokens follow the pattern:{text;type;value}
- text: The user-facing label.
- type: One of the supported categories determining the replacement style.
- value: A key or identifier used to fetch the associated asset or record.
For a detailed list of all supported token types and what they map to, see Token Types
Security & Sanitization
After tokens are replaced, the raw HTML may include untrusted content. To prevent cross-site scripting (XSS) and other injection attacks, we use JSDOM
to create a virtual DOM context and DOMPurify
to sanitize the generated markup. This removes any scripts, event handlers, or unsafe attributes that could execute malicious code when rendered in the browser.
- Always validate token format before rendering to avoid malformed input.
- Limit
effect markup
length. - Sanitize all user-provided or dynamic content to remove hidden threats.
- Review and update DOMPurify regularly to benefit from security patches.
- Always re-sanitize submitted markup before inserting it into the database.
Limitations
The following characters are used to differentiate tokens from other HTML and plain text and may not be used as literal characters
- {
- ;
- }
Try it Out!
You can try out the Effect Markup Converter here!