Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

HTML Entities

From Roll20 Wiki

(Redirected from HTML replacement)
Jump to: navigation, search

Main Page: Macro Guide

HTML Entities (a.k.a. HTML Escape Characters) can be useful to escape HTML characters so they aren't processed prematurely. This is useful in creating macros, Building Character Sheets, and wiki editing.


When creating some complicated macros, usually involving nesting, you will need to use HTML entities in parts of the code to trick the Roll20 system to make it behave like you want, or some advanced tricks won't work.

Here are some HTML Entities/Escape Characters that are commonly useful to escape when creating advanced Roll20 macros. See HTML Entities or special character for more:

Character Replacement
| (pipe) |, (|)
, ,, (,)
{ {, ({)
} }, (})
& &, (&)
space  , ( )
= =, (=)
_ _, (_)
( (, (()
) ), ())
[ [, ([)
] ], (])
< &#60;, (&lt;)
> &#62;, (&gt;)
`(backtick, grave accent) &#96;, (&grave;)
*(asterisk) &#42;, (&ast;)
! &#33;, (&excl;)
"(doublequote) &#34;, (&quot;)
# &#35;, (&num;)
-(hyphen) &#45;, (&dash;)
@ &#64;, (&commat;)
% &#37;, (&percnt;)


Examples

Main Page: Roll Queries & Nesting

By using HTML entities to replace all } inside "Choose a Roll", it will now correctly process where the query ends. This is essentially to prevent the Roll Query from closing at the first } it encounters.

?{Choose a Roll|
  STR,/roll 1d20 + 3 + (?{Modifier&#125;) |
  DEX,/roll 1d20 + 2 + (?{Modifier&#125;) |
  CON,/roll 1d20 + 1 + (?{Modifier&#125;) }

If your query options contains |, you need to replace them to prevent the query thinking it's a delimiter between options.

?{Pick a pair|Alice|Bob|Bob|Charlie}

Nested Query Improvement

An fix for macros to not needing to use HTML Entities for nested macros was tried in 2021, but it was seemingly shelved at some point. There might be new try with this as part of Jumpgate updates. Andreas J. (talk) 11:40, 28 September 2024 (UTC)

Now on Dev Server: Roll Query Improvements! July 20th, 2021

Some, if not all, character substitutions might become redundant, when roll20 improves nested Roll Query handling in macros.

Now on the Dev Server(
Pro
info-users) for testing, improved roll query parsing!
Recently, an update to our character sheet code broke a workaround that some sheets were using to implement nested roll queries. Rather than fixing this workaround, we did a little extra work to properly support nested queries. Now, you should be able to nest roll queries inside of each other without needing to use any character codes.

Related