Closed Freed-Wu closed 1 year ago
https://github.com/prompt-toolkit/python-prompt-toolkit/blob/master/src/prompt_toolkit/formatted_text/base.py#L75 should let to_formatted_text
convert a string to correct formatted text from rich.
Reduce one level of indent of https://github.com/prompt-toolkit/ptpython/blob/master/ptpython/repl.py#L360-L362 can get:
Although I think rich.print
is more colorful.
If use sys.displayhook(result)
to replace https://github.com/prompt-toolkit/ptpython/blob/master/ptpython/repl.py#L360-L362, it can work. Why not provide an expression to allow user to do it?
This can fix the problem in ~/.config/ptpython/config.py
:
repl.show_result = sys.displayhook # type: ignore
This is
rich.print
:This is ptpython's output (Colors -> Syntax highlighting = on)
Can ptpython use
rich.print
to highlight output? I thinkrich.print
is better for some object, such asresnet18()
.Related: https://github.com/Textualize/rich/issues/2749
TIA!