mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 10:08:40 +00:00
docs and examples
This commit is contained in:
parent
a424fafc56
commit
b391635ee4
9 changed files with 20 additions and 10 deletions
|
@ -5,7 +5,7 @@ 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).
|
||||
|
||||
## [6.1.2] - Unreleased
|
||||
## [6.1.2] - 2020-09-11
|
||||
|
||||
### Added
|
||||
|
||||
|
@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
- The `#` sign is included in url highlighting
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed force-color switch in rich.syntax and rich.markdown commands
|
||||
|
||||
## [6.1.1] - 2020-09-07
|
||||
|
||||
### Changed
|
||||
|
|
|
@ -21,7 +21,9 @@ Welcome to Rich's documentation!
|
|||
|
||||
markup.rst
|
||||
tables.rst
|
||||
panel.rst
|
||||
padding.rst
|
||||
panel.rst
|
||||
group.rst
|
||||
columns.rst
|
||||
progress.rst
|
||||
markdown.rst
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Panel
|
||||
=====
|
||||
|
||||
To draw a border around any content, construct a :class:`~rich.panel.Panel` with any *renderable* as the first positional argument. Here's an example::
|
||||
To draw a border around text or other renderable, construct a :class:`~rich.panel.Panel` with the renderable as the first positional argument. Here's an example::
|
||||
|
||||
from rich import print
|
||||
from rich.panel import Panel
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
name = "rich"
|
||||
homepage = "https://github.com/willmcgugan/rich"
|
||||
documentation = "https://rich.readthedocs.io/en/latest/"
|
||||
version = "6.1.1"
|
||||
version = "6.1.2"
|
||||
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
|
||||
authors = ["Will McGugan <willmcgugan@gmail.com>"]
|
||||
license = "MIT"
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
from __future__ import absolute_import
|
||||
|
||||
from inspect import cleandoc, getdoc, getfile, isclass, isfunction, ismodule, signature
|
||||
from typing import Any, Iterable, List, Optional, Tuple
|
||||
from inspect import cleandoc, getdoc, getfile, isclass, ismodule, signature
|
||||
from typing import Any, Iterable, Optional, Tuple
|
||||
|
||||
from .console import Console, ConsoleOptions, RenderableType, RenderGroup, RenderResult
|
||||
from .console import RenderableType, RenderGroup
|
||||
from .highlighter import ReprHighlighter
|
||||
from .jupyter import JupyterMixin
|
||||
from .panel import Panel
|
||||
|
@ -74,7 +74,7 @@ class Inspect(JupyterMixin):
|
|||
title_text = self.highlighter(title_str)
|
||||
return title_text
|
||||
|
||||
def __rich__(self) -> "RenderableType":
|
||||
def __rich__(self) -> Panel:
|
||||
return Panel.fit(
|
||||
RenderGroup(*self._render()),
|
||||
title=self.title,
|
||||
|
|
|
@ -181,6 +181,8 @@ class RenderGroup:
|
|||
|
||||
|
||||
def render_group(fit: bool = False) -> Callable:
|
||||
"""A decorator that turns an iterable of renderables in to a group."""
|
||||
|
||||
def decorator(method):
|
||||
"""Convert a method that returns an iterable of renderables in to a RenderGroup."""
|
||||
|
||||
|
|
|
@ -78,9 +78,9 @@ class ReprHighlighter(RegexHighlighter):
|
|||
r"(?P<number>(?<!\w)\-?[0-9]+\.?[0-9]*(e[\-\+]?\d+?)?\b)",
|
||||
r"(?P<number>0x[0-9a-f]*)",
|
||||
r"(?P<path>\B(\/[\w\.\-\_\+]+)*\/)(?P<filename>[\w\.\-\_\+]*)?",
|
||||
r"(?<!\\)(?P<str>b?\'\'\'.*?(?<!\\)\'\'\'|b?\'.*?(?<!\\)\'|b?\"\"\".*?(?<!\\)\"\"\"|b?\".*?(?<!\\)\")",
|
||||
r"(?P<ipv4>[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3})",
|
||||
r"(?P<ipv4>[0-9]{1,3}\.[0-9]{1,3}\.[0-gt9]{1,3}\.[0-9]{1,3})",
|
||||
r"(?P<ipv6>([A-Fa-f0-9]{1,4}::?){1,7}[A-Fa-f0-9]{1,4})",
|
||||
r"(?<!\\)(?P<str>b?\'\'\'.*?(?<!\\)\'\'\'|b?\'.*?(?<!\\)\'|b?\"\"\".*?(?<!\\)\"\"\"|b?\".*?(?<!\\)\")",
|
||||
r"(?P<url>https?:\/\/[0-9a-zA-Z\$\-\_\+\!`\(\)\,\.\?\/\;\:\&\=\%\#]*)",
|
||||
r"(?P<uuid>[a-fA-F0-9]{8}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{12})",
|
||||
]
|
||||
|
|
|
@ -511,6 +511,7 @@ if __name__ == "__main__": # pragma: no cover
|
|||
"--force-color",
|
||||
dest="force_color",
|
||||
action="store_true",
|
||||
default=None,
|
||||
help="force color for non-terminals",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
|
|
@ -326,6 +326,7 @@ if __name__ == "__main__": # pragma: no cover
|
|||
"--force-color",
|
||||
dest="force_color",
|
||||
action="store_true",
|
||||
default=None,
|
||||
help="force color for non-terminals",
|
||||
)
|
||||
parser.add_argument(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue