mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Colorize also the code in single backticks
This commit is contained in:
parent
2113e8c055
commit
4dd62a3ed1
1 changed files with 6 additions and 3 deletions
|
@ -69,15 +69,18 @@ module Ameba::Formatter
|
||||||
output_paragraph rule.description
|
output_paragraph rule.description
|
||||||
end
|
end
|
||||||
|
|
||||||
rule_doc = colorize_code_blocks(rule.class.parsed_doc)
|
rule_doc = colorize_code_fences(rule.class.parsed_doc)
|
||||||
return unless rule_doc
|
return unless rule_doc
|
||||||
|
|
||||||
output_title "Detailed description"
|
output_title "Detailed description"
|
||||||
output_paragraph rule_doc
|
output_paragraph rule_doc
|
||||||
end
|
end
|
||||||
|
|
||||||
private def colorize_code_blocks(string)
|
private def colorize_code_fences(string)
|
||||||
string.try &.gsub(/```(.+?)```/m, &.colorize(:dark_gray))
|
return unless string
|
||||||
|
string
|
||||||
|
.gsub(/```(.+?)```/m, &.colorize(:dark_gray))
|
||||||
|
.gsub(/`(?!`)(.+?)`/, &.colorize(:dark_gray))
|
||||||
end
|
end
|
||||||
|
|
||||||
private def output_title(title)
|
private def output_title(title)
|
||||||
|
|
Loading…
Reference in a new issue