A way to escape emoji? #3541
Answered
by
TomJGooding
manoelpqueiroz
asked this question in
Q&A
-
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.
Answered by
TomJGooding
Oct 28, 2024
Replies: 1 comment 1 reply
-
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.
1 reply
Answer selected by
manoelpqueiroz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can disable emojis using the
Console
class: