Skip to content

Commit

Permalink
docs and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Sep 11, 2020
1 parent a424faf commit b391635
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 10 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/panel.rst
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions rich/_inspect.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -74,7 +74,7 @@ def _make_title(self, obj: Any) -> Text:
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,
Expand Down
2 changes: 2 additions & 0 deletions rich/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ def __rich_console__(


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."""

Expand Down
4 changes: 2 additions & 2 deletions rich/highlighter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})",
]
Expand Down
1 change: 1 addition & 0 deletions rich/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ def __rich_console__(
"--force-color",
dest="force_color",
action="store_true",
default=None,
help="force color for non-terminals",
)
parser.add_argument(
Expand Down
1 change: 1 addition & 0 deletions rich/syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ def __rich_console__(
"--force-color",
dest="force_color",
action="store_true",
default=None,
help="force color for non-terminals",
)
parser.add_argument(
Expand Down

0 comments on commit b391635

Please sign in to comment.