Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console markup escaping issue #1944

Closed
willmcgugan opened this issue Feb 9, 2022 Discussed in #1939 · 4 comments · Fixed by #1950
Closed

console markup escaping issue #1944

willmcgugan opened this issue Feb 9, 2022 Discussed in #1939 · 4 comments · Fixed by #1950
Assignees

Comments

@willmcgugan
Copy link
Collaborator

Discussed in #1939

Originally posted by codenotworking February 9, 2022
My code:

from rich import print as rprint

rprint("[dim white]\[url=[/]")

I'm trying to print simply [url= but I end up getting [url=[/]. What am I doing wrong?

@willmcgugan
Copy link
Collaborator Author

@codenotworking You may have discovered an edge case with the escaping.

In the meantime, you could do this:

rprint("[dim white]\[url=")

More generally, you could work with a Text object which will give you more fine control.

@willmcgugan
Copy link
Collaborator Author

@darrenburns Can you look at why this doesn't work. I would have expected that to render [url=

@codenotworking
Copy link

In the meantime, you could do this:

rprint("[dim white]\[url=")
# Code
rprint("[dim white]\[url=[cyan]https://github.com/[/][dim white]][/]")

# Result
[url=[cyan]https://github.com/]

More generally, you could work with a Text object which will give you more fine control.

Got it. It seems rich.Text will serve me.

@github-actions
Copy link

Did I solve your problem?

Why not buy the devs a coffee to say thanks?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants