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 | ||||
|       end | ||||
| 
 | ||||
|       rule_doc = colorize_code_blocks(rule.class.parsed_doc) | ||||
|       rule_doc = colorize_code_fences(rule.class.parsed_doc) | ||||
|       return unless rule_doc | ||||
| 
 | ||||
|       output_title "Detailed description" | ||||
|       output_paragraph rule_doc | ||||
|     end | ||||
| 
 | ||||
|     private def colorize_code_blocks(string) | ||||
|       string.try &.gsub(/```(.+?)```/m, &.colorize(:dark_gray)) | ||||
|     private def colorize_code_fences(string) | ||||
|       return unless string | ||||
|       string | ||||
|         .gsub(/```(.+?)```/m, &.colorize(:dark_gray)) | ||||
|         .gsub(/`(?!`)(.+?)`/, &.colorize(:dark_gray)) | ||||
|     end | ||||
| 
 | ||||
|     private def output_title(title) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue