Skip to content

Commit

Permalink
Merge pull request #2439 from Textualize/new-markdown-parser
Browse files Browse the repository at this point in the history
New markdown parser
  • Loading branch information
willmcgugan committed Jan 18, 2023
2 parents d919868 + 3f316c5 commit 9d4a1f3
Show file tree
Hide file tree
Showing 11 changed files with 1,063 additions and 983 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11.0"]
defaults:
run:
shell: bash
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

### Changed

- Switch Markdown parsing from commonmark to markdown-it-py https://github.com/Textualize/rich/pull/2439

## [13.1.0] - 2023-01-14

### Fixed
Expand Down
1,744 changes: 881 additions & 863 deletions poetry.lock

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ include = ["rich/py.typed"]
python = ">=3.7.0"
typing-extensions = { version = ">=4.0.0, <5.0", python = "<3.9" }
pygments = "^2.6.0"
commonmark = "^0.9.0"
ipywidgets = { version = "^7.5.1", optional = true }

markdown-it-py = "^2.1.0"

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

[[tool.mypy.overrides]]
module = ["pygments.*", "IPython.*", "commonmark.*", "ipywidgets.*"]
module = ["pygments.*", "IPython.*", "ipywidgets.*"]
ignore_missing_imports = true

[tool.pytest.ini_options]
Expand Down
10 changes: 6 additions & 4 deletions rich/default_styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,11 @@
"tree.line": Style(),
"markdown.paragraph": Style(),
"markdown.text": Style(),
"markdown.emph": Style(italic=True),
"markdown.em": Style(italic=True),
"markdown.emph": Style(italic=True), # For commonmark backwards compatibility
"markdown.strong": Style(bold=True),
"markdown.code": Style(bgcolor="black", color="bright_white"),
"markdown.code_block": Style(dim=True, color="cyan", bgcolor="black"),
"markdown.code": Style(bold=True, color="cyan", bgcolor="black"),
"markdown.code_block": Style(color="cyan", bgcolor="black"),
"markdown.block_quote": Style(color="magenta"),
"markdown.list": Style(color="cyan"),
"markdown.item": Style(),
Expand All @@ -157,7 +158,8 @@
"markdown.h6": Style(italic=True),
"markdown.h7": Style(italic=True, dim=True),
"markdown.link": Style(color="bright_blue"),
"markdown.link_url": Style(color="blue"),
"markdown.link_url": Style(color="blue", underline=True),
"markdown.s": Style(strike=True),
"iso8601.date": Style(color="blue"),
"iso8601.time": Style(color="magenta"),
"iso8601.timezone": Style(color="yellow"),
Expand Down

0 comments on commit 9d4a1f3

Please sign in to comment.