Skip to content

Commit c3ef3f3

Browse files
authored
Remove rich markdown header override (#2938)
As rich 13.2 is changing internals related to markdown rendering, it is better to remove our custom header rendering override, so users can use the library with any version of rich.
1 parent f42dbdb commit c3ef3f3

File tree

4 files changed

+7
-21
lines changed

4 files changed

+7
-21
lines changed

.config/requirements-lock.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pygments==2.13.0
2626
pyrsistent==0.19.3
2727
pyyaml==6.0
2828
resolvelib==0.8.1
29-
rich==13.0.0
29+
rich==13.2.0
3030
ruamel-yaml==0.17.21
3131
setuptools==65.6.3
3232
subprocess-tee==0.4.1

.config/requirements.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ certifi==2022.12.7
1616
cffi==1.15.1
1717
charset-normalizer==3.0.1
1818
click==8.1.3
19-
commonmark==0.9.1
2019
coverage==7.0.5
2120
coverage-enable-subprocess==1.0
2221
cryptography==39.0.0
@@ -64,7 +63,7 @@ pytz==2022.7.1
6463
pyyaml==6.0
6564
requests==2.28.2
6665
resolvelib==0.8.1
67-
rich==13.1.0
66+
rich==13.2.0
6867
ruamel-yaml==0.17.21
6968
ruamel-yaml-clib==0.2.7
7069
setuptools==66.0.0

.pre-commit-config.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ repos:
5656
- prettier-plugin-toml
5757
- prettier-plugin-sort-json
5858
- repo: https://github.com/streetsidesoftware/cspell-cli
59-
rev: v6.17.1
59+
rev: v6.19.2
6060
hooks:
6161
- id: cspell
6262
# entry: codespell --relative
6363
args: [--relative, --no-progress, --no-summary]
6464
name: Spell check with cspell
6565
- repo: https://github.com/sirosen/check-jsonschema
66-
rev: 0.20.0
66+
rev: 0.21.0
6767
hooks:
6868
- id: check-github-workflows
6969
- repo: https://github.com/pre-commit/pre-commit-hooks.git
@@ -169,7 +169,7 @@ repos:
169169
- filelock
170170
- jinja2
171171
- pytest>=7.2.0
172-
- rich>=11.0.0
172+
- rich>=13.2.0
173173
- ruamel.yaml
174174
- types-PyYAML
175175
- types-jsonschema>=4.4.2
@@ -182,7 +182,7 @@ repos:
182182
plugins/.*
183183
)$
184184
- repo: https://github.com/pycqa/pylint
185-
rev: v2.16.0b0
185+
rev: v2.16.0b1
186186
hooks:
187187
- id: pylint
188188
args:
@@ -196,7 +196,7 @@ repos:
196196
- jsonschema>=4.9.0
197197
- pytest>=7.2.0
198198
- pyyaml
199-
- rich>=11.0.0
199+
- rich>=13.2.0
200200
- ruamel.yaml
201201
- sphinx
202202
- typing_extensions

src/ansiblelint/color.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,6 @@ def render_yaml(text: str) -> Syntax:
8888
return Syntax(text, "yaml", theme="ansi_dark")
8989

9090

91-
# pylint: disable=redefined-outer-name,unused-argument
92-
def _rich_heading_custom_rich_console(
93-
self: rich.markdown.Heading,
94-
console: rich.console.Console,
95-
options: rich.console.ConsoleOptions,
96-
) -> rich.console.RenderResult:
97-
"""Override for rich console heading."""
98-
yield f"[bold]{self.level * '#'} {self.text}[/]"
99-
100-
10191
# pylint: disable=redefined-outer-name,unused-argument
10292
def _rich_codeblock_custom_rich_console(
10393
self: rich.markdown.CodeBlock,
@@ -115,7 +105,4 @@ def _rich_codeblock_custom_rich_console(
115105
yield syntax
116106

117107

118-
# Monkey-patch rich to alter its rendering of headings
119-
# https://github.com/python/mypy/issues/2427
120-
rich.markdown.Heading.__rich_console__ = _rich_heading_custom_rich_console # type: ignore
121108
rich.markdown.CodeBlock.__rich_console__ = _rich_codeblock_custom_rich_console # type: ignore

0 commit comments

Comments
 (0)