Skip to content

Commit

Permalink
absolute img links
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Feb 22, 2020
1 parent b48a2f6 commit 0ebe0eb
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ from rich import print
print("Hello, [bold magenta]World[/bold magenta]!", ":vampire:", locals())
```

![Hello World](./imgs/print.png)
![Hello World](https://github.com/willmcgugan/rich/raw/master/imgs/print.png)

## Console Printing

Expand Down Expand Up @@ -50,15 +50,15 @@ console.print("Hello", "World!", style="bold red")

The output will be something like the following:

![Hello World](./imgs/hello_world.png)
![Hello World](https://github.com/willmcgugan/rich/raw/master/imgs/hello_world.png)

That's fine for styling a line of text at a time. For more finely grained styling, Rich renders a special markup which is similar in syntax to [bbcode](https://en.wikipedia.org/wiki/BBCode). Here's an example:

```python
console.print("Where there is a [bold cyan]Will[/bold cyan] there [u]is[/u] a [i]way[/i].")
```

![Console Markup](./imgs/where_there_is_a_will.png)
![Console Markup](https://github.com/willmcgugan/rich/raw/master/imgs/where_there_is_a_will.png)

## Console Logging

Expand Down Expand Up @@ -89,7 +89,7 @@ test_log()

The above produces the following output:

![Log](./imgs/log.png)
![Log](https://github.com/willmcgugan/rich/raw/master/imgs/log.png)

Note the `log_locals` argument, which outputs a table containing the local variables where the log method was called.

Expand Down Expand Up @@ -124,7 +124,7 @@ console.print(markdown)

This will produce output something like the following:

![markdown](./imgs/markdown.png)
![markdown](https://github.com/willmcgugan/rich/raw/master/imgs/markdown.png)

## Syntax Highlighting

Expand Down Expand Up @@ -156,7 +156,7 @@ console.print(syntax)

This will produce the following output:

![syntax](./imgs/syntax.png)
![syntax](https://github.com/willmcgugan/rich/raw/master/imgs/syntax.png)

## Tables

Expand Down Expand Up @@ -194,24 +194,24 @@ console.print(table)

This produces the following output:

![table](./imgs/table.png)
![table](https://github.com/willmcgugan/rich/raw/master/imgs/table.png)

Note that console markup is rendered in the same was as `print()` and `log()`. In fact, anything that is renderable by Rich may be included in the headers / rows (even other tables).

The `Table` class is smart enough to resize columns to fit the available width of the terminal, wrapping text as required. Here's the same example, with the terminal made smaller than the table above:

![table2](./imgs/table2.png)
![table2](https://github.com/willmcgugan/rich/raw/master/imgs/table2.png)

## Tracebacks

Rich can render beautiful tracebacks which are easier to read and show more code than standard Python tracebacks. You can set Rich as the default traceback handler so all uncaught exceptions will be rendered by Rich.

Here's what it looks like on OSX (similar on Linux):

![traceback](./imgs/traceback.png)
![traceback](https://github.com/willmcgugan/rich/raw/master/imgs/traceback.png)

Here's what it looks like on Windows:

![traceback_windows](./imgs/traceback_windows.png)
![traceback_windows](https://github.com/willmcgugan/rich/raw/master/imgs/traceback_windows.png)

See the [rich traceback](https://rich.readthedocs.io/en/latest/traceback.html) documentation for the details.

0 comments on commit 0ebe0eb

Please sign in to comment.