Add support for code blocks

This commit is contained in:
Darren Burns 2022-07-27 14:33:10 +01:00
parent b3d70df40a
commit 73552a8058
No known key found for this signature in database
GPG key ID: B0939B45037DC345
4 changed files with 79 additions and 10 deletions

View file

@ -51,10 +51,23 @@ Numbered list:
![progress](https://github.com/willmcgugan/rich/raw/master/imgs/progress.gif)
```
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)