Fix rich markup rendering for message_text
This commit is contained in:
@@ -110,10 +110,11 @@ def main():
|
|||||||
username_style = Style(color=user_color, bold=True)
|
username_style = Style(color=user_color, bold=True)
|
||||||
|
|
||||||
# Create a Text object for the username and apply style directly
|
# Create a Text object for the username and apply style directly
|
||||||
username_text = Text(f"{username_style}]{author_display_name}: ", style=username_style)
|
username_text = Text(f"{author_display_name}: ", style=username_style)
|
||||||
|
|
||||||
# Create a Text object for the full message
|
# Create a Text object for the full message
|
||||||
full_message_text = Text.assemble(username_text, message_text)
|
# Pass markup=True to interpret rich markup within message_text
|
||||||
|
full_message_text = Text.assemble(username_text, Text(message_text, markup=True))
|
||||||
|
|
||||||
# Alternate background styles
|
# Alternate background styles
|
||||||
background_style = Style(bgcolor="#2B2B2B") if message_count % 2 == 0 else Style(bgcolor="#3A3A3A")
|
background_style = Style(bgcolor="#2B2B2B") if message_count % 2 == 0 else Style(bgcolor="#3A3A3A")
|
||||||
@@ -138,4 +139,4 @@ def main():
|
|||||||
console.print(f"[green]Chat log saved to {log_filename}[/green]")
|
console.print(f"[green]Chat log saved to {log_filename}[/green]")
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user