How to put special characters -"<" and ">" - into Component Attributes for display in Component Options



First: Ignore this if you only have SketchUp Make - you can use Dynamic Components, but you can’t create them. For that, you need SketchUp Pro.

For various reasons, I wanted my Component Options box to show a few words within angle brackets in the predefined DC Attribute “Description”. Something like this:
"this <and> that"

Short answer: You can do it, but it’s not easy! In the Attribute, you have to enter:
"this &#60;and&#62; that"

Read on for background and how I found this workaround. I should mention up front that @john_drivenupthewall should be credited with this!

Here’s my first try:

As you can see if you watch the above, the <and> has disappeared! And there is a good explanation why: SU only allows a very limited set of HTML in this field, and <and> isn’t one of them. (For you nitpickers out there, I know, it isn’t even an HTML tag!) I think SU just suppresses display of anything that looks like an HTML tag, unless it’s one they allow, in which case they process it appropriately to alter the display in Component Options.

So, devious, tricky, and sneaky person that I am, I thought I’d try to trick SU into displaying what I wanted. How? By using the HTML Entity Shortcuts: &lt; for "<" and "&gt;" for ">" Here’s the result:

Looks like I did it, Yes? Actually no. See that SU has replaced my shortcuts with the actual characters, not only in the Component Options box as I wanted, but also in the text I entered in the Description attribute! Which causes another problem:

Do you see it? I went into the text in the Component Attributes, didn’t change a thing, hit <enter> to “finish” my (non) edit of the text, and I’m back to the original problem!

This was when @john_drivenupthewall got interested - and found the workaround! Don’t use HTML Entity shortcuts, use the full, hexadecimal HTML Entity instead. As follows:

Success! It displays as I want it to in the Component Options box - and the text I used to create it remains in the Component Attribute. I can easily edit it without side effects!

In order to keep this post brief (from me - who suffers from usually providing Too Much Information), I won’t get into the, frankly weird, results I got when I tried replacing only the opening angle bracket (like: "this &lt;and> that")!