word wrap code blocks

This commit is contained in:
Will McGugan 2021-11-07 15:13:38 +00:00
parent fcbeffcfa1
commit 9762a2f116
2 changed files with 5 additions and 1 deletions

View File

@ -20,6 +20,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed exception in IPython when disabling pprint with %pprint https://github.com/willmcgugan/rich/issues/1646
- Fixed issue where values longer than the console width produced invalid JSON https://github.com/willmcgugan/rich/issues/1653
## Changed
- Markdown codeblocks now word-wrap https://github.com/willmcgugan/rich/issues/1515
## [10.12.0] - 2021-10-06
### Updated

View File

@ -177,7 +177,7 @@ class CodeBlock(TextElement):
) -> RenderResult:
code = str(self.text).rstrip()
syntax = Panel(
Syntax(code, self.lexer_name, theme=self.theme),
Syntax(code, self.lexer_name, theme=self.theme, word_wrap=True),
border_style="dim",
box=box.SQUARE,
)