Debian Codegraph @

docs/source/markdown.rst

raw
1 Markdown
2 ========
3
4 Rich can render Markdown to the console. To render markdown, construct a :class:`~rich.markdown.Markdown` object then print it to the console. Markdown is a great way of adding rich content to your command line applications. Here's an example of use::
5
6 MARKDOWN = """
7 # This is an h1
8
9 Rich can do a pretty *decent* job of rendering markdown.
10
11 1. This is a list item
12 2. This is another list item
13 """
14 from rich.console import Console
15 from rich.markdown import Markdown
16
17 console = Console()
18 md = Markdown(MARKDOWN)
19 console.print(md)
20
21 Note that code blocks are rendered with full syntax highlighting!
22
23 You can also use the Markdown class from the command line. The following example displays a readme in the terminal::
24
25 python -m rich.markdown README.md
26
27 Run the following to see the full list of arguments for the markdown command::
28
29 python -m rich.markdown -h