However, since I'm using Rich's print function, it will always render the :tada: emoji as 🎉. I have tried using rich.markup.escape as the docs suggest, but to no avail.
Is it possible to escape the shortcode in this case?
","upvoteCount":1,"answerCount":1,"acceptedAnswer":{"@type":"Answer","text":"You can disable emojis using the Console class:
from rich.console import Console\n\n# Disable all emojis\nconsole = Console(emoji=False)\n\n# Disable emojis for specific prints\nconsole.print(\"No emoji! :tada:\", emoji=False)-
|
Hi guys, I have a f-string in my application where I want to render some colour output with Rich, but also a unformatted string with an emoji shortcode: import textwrap
from rich import print
message = f'''
Upload initial code to {scm_platform}:
[bold red]$[/] [green]git[/] [yellow]add[/] [blue].[/]
[bold red]$[/] [green]git[/] [yellow]commit[/] [blue]-m[/] [yellow]:tada: Initial commit"[/]
[bold red]$[/] [green]git[/] [yellow]remote add[/] [red]origin[/] [blue]{scm_base_url}.git[/]
[bold red]$[/] [green]git[/] [yellow]push[/] [cyan]-u[/] [blue]origin master[/]
'''
print(textwrap.dedent(message))However, since I'm using Rich's Is it possible to escape the shortcode in this case? |
Beta Was this translation helpful? Give feedback.
-
|
You can disable emojis using the from rich.console import Console
# Disable all emojis
console = Console(emoji=False)
# Disable emojis for specific prints
console.print("No emoji! :tada:", emoji=False) |
Beta Was this translation helpful? Give feedback.
You can disable emojis using the
Consoleclass: