RichText: Guide?

Hi,

I’ve read the docs / blog post on the newish RichText component, but I’m wondering where a more complete guide to what you can, and cannot do, can be found?

For example, I’m looking at python’s “rich” library as a way to create rich text that I can pass to Anvil to display, but the two dont seem to play nice when I try and use the markup strings provided by ‘rich’.

For example, this works in ‘rich’ but not in RichText/Anvil.
'[bold magenta]Hello [/bold magenta]World'

https://rich.readthedocs.io/en/stable/text.html

The rich library looks to be designed to render markup to the console. Anvil’s rich text component is designed to render markup to the form. They don’t really seem like they’d be able to be hooked up.

If you have Markdown already, you can put that straight into the rich text component and it will render it.

Sorry - I thought I had responded! I guess my issue is more, where is a good guide to general richtext that’s applicable to use in Anvil? (vs the rich module which isn’t)

Are you looking for this?

1 Like

Great, thanks! That’s exactly what I’m after. Is this the extent of the formatting I can do in the Anvil box as well?

The Anvil RichText has 3 options: markdown, html and text.

Html is a small subset of the full html for security reasons.

Markdown is the full basic markdown (as opposed to one of the flavors with custom additions available out there).

The thing I miss in both markdown and html is setting the color of the text or other font options.

On the bright side my apps have fewer colors and are more consistent :thinking:.

I always think that tomorrow I will play with the css for each header level, but I’ve never done it (I guess I don’t miss that much after all).

1 Like