From 5ccd78710fac92d84e66403a2d8ac28c2ed553f5 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Tue, 28 Apr 2020 15:06:50 +0100 Subject: [PATCH] docs --- docs/source/panel.rst | 2 +- docs/source/tables.rst | 7 +++++++ pyproject.toml | 2 +- rich/panel.py | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/docs/source/panel.rst b/docs/source/panel.rst index 0ae74bdd..1bf54c9e 100644 --- a/docs/source/panel.rst +++ b/docs/source/panel.rst @@ -7,4 +7,4 @@ To draw a border around any content construct a :class:`~rich.panel.Panel` objec from rich.panel import Panel print(Panel("Hello, [red]World!")) -You can draw a panel around anything that Rich knows how to render. \ No newline at end of file +You can change the style of the panel by setting the ``box`` argument to the Panel constructor. See :ref:`appendix-box` for a list of available box styles. \ No newline at end of file diff --git a/docs/source/tables.rst b/docs/source/tables.rst index a7bea90a..b16f2b6e 100644 --- a/docs/source/tables.rst +++ b/docs/source/tables.rst @@ -42,4 +42,11 @@ This produces the following output: Rich is quite smart about rendering the table. It will adjust the column widths to fit the contents and will wrap text if it doesn't fit. You can also add anything that Rich knows how to render as a title or row cell (even another table)! +You can set the border style by importing one of the preset :class:`~rich.box.Box` objects and setting the ``box`` argument in the table constructor. Here's an example that modifies the look of the Star Wars table:: + + from rich import box + table = Table(title="Star Wars Movies", box=box.MINIMAL_DOUBLE_HEAD) + +See :ref:`appendix-box` for other box styles. + The :class:`~rich.table.Table` class offers a number of configuration options to set the look and feel of the table, including how borders are rendered and the style and alignment of the columns. diff --git a/pyproject.toml b/pyproject.toml index 1af0d95c..55fb091e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "rich" homepage = "https://github.com/willmcgugan/rich" documentation = "https://rich.readthedocs.io/en/latest/" -version = "0.8.12" +version = "0.8.13" description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" authors = ["Will McGugan "] license = "MIT" diff --git a/rich/panel.py b/rich/panel.py index 6ae9d219..0ba4ad5b 100644 --- a/rich/panel.py +++ b/rich/panel.py @@ -18,7 +18,7 @@ class Panel: """A console renderable that draws a border around its contents. Example:: - >>> console.print(Panel("Hello, World!)) + >>> console.print(Panel("Hello, World!")) Args: renderable (RenderableType): A console renderable object.