summaryrefslogtreecommitdiff
path: root/lib/pry/helpers/documentation_helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pry/helpers/documentation_helpers.rb')
-rw-r--r--lib/pry/helpers/documentation_helpers.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/pry/helpers/documentation_helpers.rb b/lib/pry/helpers/documentation_helpers.rb
index 1ce6be2b..024e1477 100644
--- a/lib/pry/helpers/documentation_helpers.rb
+++ b/lib/pry/helpers/documentation_helpers.rb
@@ -17,12 +17,13 @@ class Pry
last_match_ruby = proc do
SyntaxHighlighter.highlight(Regexp.last_match(1))
end
+
comment.gsub(%r{<code>(?:\s*\n)?(.*?)\s*</code>}m, &last_match_ruby)
.gsub(%r{<em>(?:\s*\n)?(.*?)\s*</em>}m) { "\e[1m#{Regexp.last_match(1)}\e[0m" }
.gsub(%r{<i>(?:\s*\n)?(.*?)\s*</i>}m) { "\e[1m#{Regexp.last_match(1)}\e[0m" }
.gsub(%r{<tt>(?:\s*\n)?(.*?)\s*</tt>}m, &last_match_ruby)
.gsub(/\B\+(\w+?)\+\B/) { "\e[32m#{Regexp.last_match(1)}\e[0m" }
- .gsub(/((?:^[ \t]+.+(?:\n+|\Z))+)/, &last_match_ruby)
+ .gsub(/((?:^[ \t]+(?:(?!.+\e\[)).+(?:\n+|\Z))+)/, &last_match_ruby)
.gsub(/`(?:\s*\n)?([^\e]*?)\s*`/) { "`#{last_match_ruby.call}`" }
end