Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed Apr 2, 2022
1 parent dc3998a commit 6b9adfa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1690,7 +1690,8 @@ Major version bump for a breaking change to `Text.stylize signature`, which corr

- First official release, API still to be stabilized

[unreleased]: https://github.com/willmcgugan/rich/compare/v12.0.1...HEAD
[unreleased]: https://github.com/willmcgugan/rich/compare/v12.1.0...HEAD
[12.1.0]: https://github.com/willmcgugan/rich/compare/v12.0.1...v12.1.0
[12.0.1]: https://github.com/willmcgugan/rich/compare/v12.0.0...v12.0.1
[12.0.0]: https://github.com/willmcgugan/rich/compare/v11.2.0...v12.0.0
[11.2.0]: https://github.com/willmcgugan/rich/compare/v11.1.0...v11.2.0
Expand Down
16 changes: 6 additions & 10 deletions docs/source/console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,18 +261,15 @@ For examples of the html output generated by Rich Console, see :ref:`appendix-co
Exporting SVGs
^^^^^^^^^^^^^^

When using :meth:`~rich.console.Console.export_svg` or :meth:`~rich.console.Console.save_svg`, the width of the generated SVG will
match the width (in terms of character cells) of your terminal window. The height of the exported SVG will scale automatically to accommodate the console output.
When using :meth:`~rich.console.Console.export_svg` or :meth:`~rich.console.Console.save_svg`, the width of the SVG will match the width of your terminal window (in terms of characters), while the height will scale automatically to accommodate the console output.

The generated SVG can be viewed inside any web browser, and can be included on a webpage either by directly including the SVG markup
or by referencing the file itself using an ``<img>`` tag. For finer control over the dimensions, you'll have to use an ``<img>`` tag.
You can open the SVG in a web browser. You can also insert it in to a webpage with an ``<img>`` tag or by copying the markup in to your HTML.

The image below shows an example of an SVG exported by Rich.

.. image:: ../images/svg_export.svg

You can customise the theme used during SVG export by importing the desired theme from the :mod:`rich.terminal_theme` module and passing it to
:meth:`~rich.console.Console.export_svg` or :meth:`~rich.console.Console.save_svg` via the ``theme`` parameter::
You can customize the theme used during SVG export by importing the desired theme from the :mod:`rich.terminal_theme` module and passing it to :meth:`~rich.console.Console.export_svg` or :meth:`~rich.console.Console.save_svg` via the ``theme`` parameter::


from rich.console import Console
Expand All @@ -281,8 +278,7 @@ You can customise the theme used during SVG export by importing the desired them
console = Console(record=True)
console.save_svg("example.svg", theme=MONOKAI)

Alternatively, you can create your own theme by constructing a :class:`rich.terminal_theme.TerminalTheme` instance
yourself and passing that in.
Alternatively, you can create a them of your own by constructing a :class:`rich.terminal_theme.TerminalTheme` instance yourself and passing that in.

Error console
-------------
Expand All @@ -299,7 +295,7 @@ You might also want to set the ``style`` parameter on the Console to make error
File output
-----------

You can also tell the Console object to write to a file by setting the ``file`` argument on the constructor -- which should be a file-like object opened for writing text. You could use this to write to a file without the output ever appearing on the terminal. Here's an example::
You can tell the Console object to write to a file by setting the ``file`` argument on the constructor -- which should be a file-like object opened for writing text. You could use this to write to a file without the output ever appearing on the terminal. Here's an example::

import sys
from rich.console import Console
Expand All @@ -309,7 +305,7 @@ You can also tell the Console object to write to a file by setting the ``file``
console = Console(file=report_file)
console.rule(f"Report Generated {datetime.now().ctime()}")

Note that when writing to a file you may want to explicitly the ``width`` argument if you don't want to wrap the output to the current console width.
Note that when writing to a file you may want to explicitly set the ``width`` argument if you don't want to wrap the output to the current console width.

Capturing output
----------------
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 = "12.0.1"
version = "12.1.0"
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

0 comments on commit 6b9adfa

Please sign in to comment.