Skip to content

Commit 9d4a1f3

Browse files
authored
Merge pull request #2439 from Textualize/new-markdown-parser
New markdown parser
2 parents d919868 + 3f316c5 commit 9d4a1f3

11 files changed

+1063
-983
lines changed

.github/workflows/pythonpackage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
matrix:
1010
os: [windows-latest, ubuntu-latest, macos-latest]
11-
python-version: ["3.7", "3.8", "3.9", "3.10"]
11+
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0"]
1212
defaults:
1313
run:
1414
shell: bash

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
10+
### Changed
11+
12+
- Switch Markdown parsing from commonmark to markdown-it-py https://github.com/Textualize/rich/pull/2439
13+
814
## [13.1.0] - 2023-01-14
915

1016
### Fixed

poetry.lock

Lines changed: 881 additions & 863 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ include = ["rich/py.typed"]
2929
python = ">=3.7.0"
3030
typing-extensions = { version = ">=4.0.0, <5.0", python = "<3.9" }
3131
pygments = "^2.6.0"
32-
commonmark = "^0.9.0"
3332
ipywidgets = { version = "^7.5.1", optional = true }
34-
33+
markdown-it-py = "^2.1.0"
3534

3635
[tool.poetry.extras]
3736
jupyter = ["ipywidgets"]
@@ -57,7 +56,7 @@ strict = true
5756
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
5857

5958
[[tool.mypy.overrides]]
60-
module = ["pygments.*", "IPython.*", "commonmark.*", "ipywidgets.*"]
59+
module = ["pygments.*", "IPython.*", "ipywidgets.*"]
6160
ignore_missing_imports = true
6261

6362
[tool.pytest.ini_options]

rich/default_styles.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,11 @@
138138
"tree.line": Style(),
139139
"markdown.paragraph": Style(),
140140
"markdown.text": Style(),
141-
"markdown.emph": Style(italic=True),
141+
"markdown.em": Style(italic=True),
142+
"markdown.emph": Style(italic=True), # For commonmark backwards compatibility
142143
"markdown.strong": Style(bold=True),
143-
"markdown.code": Style(bgcolor="black", color="bright_white"),
144-
"markdown.code_block": Style(dim=True, color="cyan", bgcolor="black"),
144+
"markdown.code": Style(bold=True, color="cyan", bgcolor="black"),
145+
"markdown.code_block": Style(color="cyan", bgcolor="black"),
145146
"markdown.block_quote": Style(color="magenta"),
146147
"markdown.list": Style(color="cyan"),
147148
"markdown.item": Style(),
@@ -157,7 +158,8 @@
157158
"markdown.h6": Style(italic=True),
158159
"markdown.h7": Style(italic=True, dim=True),
159160
"markdown.link": Style(color="bright_blue"),
160-
"markdown.link_url": Style(color="blue"),
161+
"markdown.link_url": Style(color="blue", underline=True),
162+
"markdown.s": Style(strike=True),
161163
"iso8601.date": Style(color="blue"),
162164
"iso8601.time": Style(color="magenta"),
163165
"iso8601.timezone": Style(color="yellow"),

0 commit comments

Comments
 (0)