How to disable styles? #120
Replies: 3 comments
-
I am afraid this cannot be disabled "globally" at the moment. rich-argparse considers the description and help texts as console markup to allow for a simple usage like this: parser.add_argument("--foo", help="this argument is very [bold]IMPORTANT:[/bold]")
parser.add_argument("--bar", help="this is a [red]DANGEROUS[/red] argument, use it carefully") You can escape these brackets though using a backslash and rich will know that they should not be interpreted as markup. In your example you'd write With that being said, I can see that this may be considered cumbersome for a large application with lots of these escapes. I'll look into adding an option to disable markup globally. |
Beta Was this translation helpful? Give feedback.
-
I was aware what this problem was caused by and of course I know I can go through all my help/usage message strings and escape them but I am simply surprised that Rich style markup is interpreted by default. The README here says when porting from vanilla This also makes it awkward to fall-back to normal |
Beta Was this translation helpful? Give feedback.
-
I've add two new options to disable markup. This will be included in the next release which will be out soon. Thank you for the feedback. |
Beta Was this translation helpful? Give feedback.
-
I have a number of Python CLI programs, some of which use subparsers, so I thought I'd try this to see how it looks. However, I find that it interprets rich styles in my code which I did not intend. E.g. it seems I have commonly written "applications[s]" to indicate one or more applications but I am getting a strike-through on all those lines. How can I disable style interpretation?
I already tried
RichHelpFormatter.highlights.clear()
andRichHelpFormatter.usage_markup = False
but no difference.Beta Was this translation helpful? Give feedback.
All reactions