diff --git a/CHANGELOG.md b/CHANGELOG.md index e53205666f..955f3922d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Added + +- Added a visual example to `Align` docstring. + ## [14.2.0] - 2025-10-09 ### Changed diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 4b04786b9c..15c9ed49db 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -33,6 +33,7 @@ The following people have contributed to the development of Rich: - [JP Hutchins](https://github.com/JPhutchins) - [Ionite](https://github.com/ionite34) - [Josh Karpel](https://github.com/JoshKarpel) +- [Pouya Karazmayan](https://github.com/AttackThwarter) - [Jan Katins](https://github.com/jankatins) - [Hugo van Kemenade](https://github.com/hugovk) - [Andrew Kettmann](https://github.com/akettmann) diff --git a/rich/align.py b/rich/align.py index cb5f31d639..2fa66b1ad3 100644 --- a/rich/align.py +++ b/rich/align.py @@ -28,6 +28,20 @@ class Align(JupyterMixin): Raises: ValueError: if ``align`` is not one of the expected values. + + Example: + .. code-block:: python + + from rich.console import Console + from rich.align import Align + from rich.panel import Panel + + console = Console() + # Create a panel 20 characters wide + p = Panel("Hello, [b]World[/b]!", style="on green", width=20) + + # Renders the panel centered in the terminal + console.print(Align(p, align="center")) """ def __init__(