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