From 53372f65db1c9c60ddd90dca795a3c2094532142 Mon Sep 17 00:00:00 2001 From: Will McGugan Date: Sat, 13 Nov 2021 09:12:38 +0000 Subject: [PATCH] added file --- CHANGELOG.md | 4 ++++ rich/highlighter.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34ac4965..f039614d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fixed superfluous new line in Status https://github.com/willmcgugan/rich/issues/1662 - Fixed infinite loop in set_cell_size https://github.com/willmcgugan/rich/issues/1682 +### Added + +- Added file protocol to URL highlighter https://github.com/willmcgugan/rich/issues/1681 + ## [10.13.0] - 2021-11-07 ### Added diff --git a/rich/highlighter.py b/rich/highlighter.py index 9e71d005..8afdd017 100644 --- a/rich/highlighter.py +++ b/rich/highlighter.py @@ -96,7 +96,7 @@ class ReprHighlighter(RegexHighlighter): r"(?P\B(\/[\w\.\-\_\+]+)*\/)(?P[\w\.\-\_\+]*)?", r"(?b?\'\'\'.*?(?[a-fA-F0-9]{8}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{4}\-[a-fA-F0-9]{12})", - r"(?P(https|http|ws|wss):\/\/[0-9a-zA-Z\$\-\_\+\!`\(\)\,\.\?\/\;\:\&\=\%\#]*)", + r"(?P(file|https|http|ws|wss):\/\/[0-9a-zA-Z\$\-\_\+\!`\(\)\,\.\?\/\;\:\&\=\%\#]*)", ), ]