Fix rich markup rendering for message_text

This commit is contained in:
2025-10-30 19:53:50 +01:00
parent bda9164f7c
commit 061276618e

View File

@@ -110,10 +110,11 @@ def main():
username_style = Style(color=user_color, bold=True)
# 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
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
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]")
if __name__ == '__main__':
main()
main()