fix(colors): bold and italics
improve(colors): consider all list markers
This commit is contained in:
		
							parent
							
								
									34a7ccfbbd
								
							
						
					
					
						commit
						b73d152aeb
					
				
							
								
								
									
										12
									
								
								main.js
								
								
								
								
							
							
						
						
									
										12
									
								
								main.js
								
								
								
								
							| 
						 | 
				
			
			@ -2104,15 +2104,13 @@ function applycolors()
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		// lists
 | 
			
		||||
		if (line.startsWith("* "))
 | 
			
		||||
		markerslist.forEach(marker =>
 | 
			
		||||
		{
 | 
			
		||||
			line = line.replace(/(\* )/g, "<span style='color:" + settings.accentcolor + "'>$1</span>");
 | 
			
		||||
		}
 | 
			
		||||
		else if (line.startsWith("- "))
 | 
			
		||||
			if (line.startsWith(marker))
 | 
			
		||||
			{
 | 
			
		||||
			line = line.replace(/(\- )/g, "<span style='color:" + settings.accentcolor + "'>$1</span>");
 | 
			
		||||
				line = line.replace(marker, "<span style='color:" + settings.accentcolor + "'>" + marker + "</span>");
 | 
			
		||||
			}
 | 
			
		||||
		// todo: use markerslist
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
		// md header
 | 
			
		||||
		if (i == 0 && line == "---")
 | 
			
		||||
| 
						 | 
				
			
			@ -2153,7 +2151,7 @@ function applycolors()
 | 
			
		|||
 | 
			
		||||
		// bold and italics
 | 
			
		||||
		line = line.replace(/(\*\*.*\*\*)/g, "<b>$1</b>");
 | 
			
		||||
		line = line.replace(/(\*.*\*)/g, "<em>$1</em>");
 | 
			
		||||
		line = line.replace(/(^\*\*.*\*)/g, "<em>$1</em>");
 | 
			
		||||
 | 
			
		||||
		// comments
 | 
			
		||||
		line = line.replace(/<\!/g, "<span style='color:lightgrey'><!");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue