mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 10:08:40 +00:00
Add support for code blocks
This commit is contained in:
parent
b3d70df40a
commit
73552a8058
4 changed files with 79 additions and 10 deletions
|
@ -51,10 +51,23 @@ Numbered list:
|
|||
|
||||

|
||||
|
||||
```
|
||||
a=1
|
||||
```
|
||||
|
||||
```python
|
||||
import this
|
||||
```
|
||||
|
||||
```somelang
|
||||
foobar
|
||||
```
|
||||
|
||||
1. List item
|
||||
|
||||
Code block
|
||||
Indented
|
||||
Like this!
|
||||
"""
|
||||
|
||||
import io
|
||||
|
@ -139,6 +152,27 @@ def test_inline_code():
|
|||
assert result == expected
|
||||
|
||||
|
||||
def test_md_3():
|
||||
md = """```
|
||||
a=1
|
||||
```
|
||||
|
||||
```python
|
||||
import this
|
||||
```
|
||||
|
||||
|
||||
Code block
|
||||
Indented
|
||||
Like this!
|
||||
|
||||
Normal text
|
||||
"""
|
||||
markdown = Markdown(md)
|
||||
result = render(markdown)
|
||||
assert result == ""
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
markdown = Markdown(MARKDOWN)
|
||||
rendered = render(markdown)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue