From 535267189aa3a22395d1e0a96e9c004361c6077c Mon Sep 17 00:00:00 2001 From: Joan Fontanals Martinez Date: Wed, 9 Nov 2022 13:12:31 +0100 Subject: [PATCH] fix: fix markup error in summary --- docarray/document/mixins/plot.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docarray/document/mixins/plot.py b/docarray/document/mixins/plot.py index ad89f95de76..d6ed51cdfb1 100644 --- a/docarray/document/mixins/plot.py +++ b/docarray/document/mixins/plot.py @@ -18,6 +18,7 @@ def __rich_console__(self, console, options): yield f":page_facing_up: [b]Document[/b]: [cyan]{self.id}[cyan]" from rich.table import Table from rich import box + from rich.text import Text my_table = Table( 'Attribute', 'Value', width=80, box=box.ROUNDED, highlight=True @@ -27,7 +28,7 @@ def __rich_console__(self, console, options): continue elif f in ('text', 'blob', 'uri') and len(getattr(self, f)) > 100: v = getattr(self, f) - my_table.add_row(f, str(v)[:100] + f'... [dim](length: {len(v)})') + my_table.add_row(f, Text(str(v)[:100] + f'... [dim](length: {len(v)})')) elif f in ('embedding', 'tensor'): from docarray.math.ndarray import to_numpy_array @@ -42,7 +43,7 @@ def __rich_console__(self, console, options): v = f'{type(getattr(self, f))} in shape {v.shape}, dtype: {v.dtype}' my_table.add_row(f, v) elif f not in ('id', 'chunks', 'matches'): - my_table.add_row(f, str(getattr(self, f))) + my_table.add_row(f, Text(str(getattr(self, f)))) if my_table.rows: yield my_table