Markdown in formulas?

I know some markdown syntax, but I’m currently having trouble figuring out how to use it in a formula to customize certain repeated text. The formula code is:
repeated.current.displayname + "@" + repeated.current.username

All I need is for a single rich text component to reflect a bold display name and normal username side-by-side with no spaces. It should look like:
Screenshot 2021-03-19 182619

If I use two asterisks in the formula, an error occurs. I suspect the text needs to be wrapped in some other symbols, but I’m drawing a blank as to what… Currently, I’m faking it with two separate text components side-by-side in a container, but we all know that opens up a big can of visual artifacting worms on smaller displays. :wink:

Any ideas? Thank you.

Tried HTML and still no luck. Any ideas, guys? Thanks.

Hi,

Have you tried using just current.displayName, without the repeated? That might help :thinking:

Hi, Cecilia, thanks for your response!

You’re right. I’m not sure why I put “repeated” before each data name. I’ve just corrected that. Thank you. But that still leaves the issue of whether it’s possible to format the appearance of rich text directly in a formula. I’m currently having this issue:


Here’s what each user component in the list looks like in Composer for some context:

And here’s what it looks like in the Preview Beta with actual test user data being streamed in from our backend:

Due to the limited vertical space, we wanted the display name and username to be side-by-side, but with the display name bolded. We were hoping to use a single rich text component (and we currently are) with a bit of formula formatting to make one element of the text bolded.

As I’ve mentioned before, originally, there were two paragraph text components side-by-side in a container with one of them bolded. If it’s not possible to stylize rich text in a formula, we could go back to the old method and just add a truncation formula to one or both components if someone should have an unusually long display name/username. Alternatively, we could set the container to wrap the components so that, in the same scenario, the username is pushed down to a second line.

It works in implementation. It just feels a bit sloppy in execution. Thoughts?

I format rich text all the time in formulas. In your example I would do:

(replacing the Double Asterisks with %% so it wont format it here)

“%%” + current.displayname + “%%” + “@” + current.username

That should technically work

2 Likes

That worked! Thank you. I didn’t realize you could successfully nest formatting markers (asterisks) inside quotation marks – as I would’ve expected it to then render the text literally as with everything else in quotes.

It came out as intended. Thanks for the solution, John. :slight_smile:

1 Like

Hi,
Kindly help me with a similar issue,
I would like to replace the marked area with a variable, but the quotations should remain the same since they are required in the api call.

Thanks.

@JOHN_WORSHAM

@all

To include quotation marks around a variable value you would do this in a formula

“(backslash)”" + variable + “(backslash)”"

but use \ in place of (backslash)


It says invalid Syntax. What am i doing wrong ?

Im going to spell it out so you can see better

(quote)(backslash)(quote)(quote) + variable + (quote)(backslash)(quote)(quote)

Thanks. it worked. @JOHN_WORSHAM