mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Update HighlightJS and fix YAML files highlighting (#1764)
* Update HighlightJS to 9.11.0 * Fix YAML files highlighting
This commit is contained in:
		
				
					committed by
					
						
						Lunny Xiao
					
				
			
			
				
	
			
			
			
						parent
						
							80cea8747f
						
					
				
				
					commit
					be5323a05f
				
			@@ -25,39 +25,41 @@ var (
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Extensions that are same as highlight classes.
 | 
			
		||||
	highlightExts = map[string]bool{
 | 
			
		||||
		".arm":    true,
 | 
			
		||||
		".as":     true,
 | 
			
		||||
		".sh":     true,
 | 
			
		||||
		".cs":     true,
 | 
			
		||||
		".cpp":    true,
 | 
			
		||||
		".c":      true,
 | 
			
		||||
		".css":    true,
 | 
			
		||||
		".cmake":  true,
 | 
			
		||||
		".bat":    true,
 | 
			
		||||
		".dart":   true,
 | 
			
		||||
		".patch":  true,
 | 
			
		||||
		".elixir": true,
 | 
			
		||||
		".erlang": true,
 | 
			
		||||
		".go":     true,
 | 
			
		||||
		".html":   true,
 | 
			
		||||
		".xml":    true,
 | 
			
		||||
		".hs":     true,
 | 
			
		||||
		".ini":    true,
 | 
			
		||||
		".json":   true,
 | 
			
		||||
		".java":   true,
 | 
			
		||||
		".js":     true,
 | 
			
		||||
		".less":   true,
 | 
			
		||||
		".lua":    true,
 | 
			
		||||
		".php":    true,
 | 
			
		||||
		".py":     true,
 | 
			
		||||
		".rb":     true,
 | 
			
		||||
		".scss":   true,
 | 
			
		||||
		".sql":    true,
 | 
			
		||||
		".scala":  true,
 | 
			
		||||
		".swift":  true,
 | 
			
		||||
		".ts":     true,
 | 
			
		||||
		".vb":     true,
 | 
			
		||||
	highlightExts = map[string]struct{}{
 | 
			
		||||
		".arm":    {},
 | 
			
		||||
		".as":     {},
 | 
			
		||||
		".sh":     {},
 | 
			
		||||
		".cs":     {},
 | 
			
		||||
		".cpp":    {},
 | 
			
		||||
		".c":      {},
 | 
			
		||||
		".css":    {},
 | 
			
		||||
		".cmake":  {},
 | 
			
		||||
		".bat":    {},
 | 
			
		||||
		".dart":   {},
 | 
			
		||||
		".patch":  {},
 | 
			
		||||
		".elixir": {},
 | 
			
		||||
		".erlang": {},
 | 
			
		||||
		".go":     {},
 | 
			
		||||
		".html":   {},
 | 
			
		||||
		".xml":    {},
 | 
			
		||||
		".hs":     {},
 | 
			
		||||
		".ini":    {},
 | 
			
		||||
		".json":   {},
 | 
			
		||||
		".java":   {},
 | 
			
		||||
		".js":     {},
 | 
			
		||||
		".less":   {},
 | 
			
		||||
		".lua":    {},
 | 
			
		||||
		".php":    {},
 | 
			
		||||
		".py":     {},
 | 
			
		||||
		".rb":     {},
 | 
			
		||||
		".scss":   {},
 | 
			
		||||
		".sql":    {},
 | 
			
		||||
		".scala":  {},
 | 
			
		||||
		".swift":  {},
 | 
			
		||||
		".ts":     {},
 | 
			
		||||
		".vb":     {},
 | 
			
		||||
		".yml":    {},
 | 
			
		||||
		".yaml":   {},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Extensions that are not same as highlight classes.
 | 
			
		||||
@@ -85,7 +87,7 @@ func FileNameToHighlightClass(fname string) string {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ext := path.Ext(fname)
 | 
			
		||||
	if highlightExts[ext] {
 | 
			
		||||
	if _, ok := highlightExts[ext]; ok {
 | 
			
		||||
		return ext[1:]
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										3
									
								
								public/plugins/highlight-9.11.0/highlight.pack.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								public/plugins/highlight-9.11.0/highlight.pack.js
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -51,7 +51,7 @@
 | 
			
		||||
 | 
			
		||||
<!-- Third-party libraries -->
 | 
			
		||||
{{if .RequireHighlightJS}}
 | 
			
		||||
	<script src="{{AppSubUrl}}/plugins/highlight-9.6.0/highlight.pack.js"></script>
 | 
			
		||||
	<script src="{{AppSubUrl}}/plugins/highlight-9.11.0/highlight.pack.js"></script>
 | 
			
		||||
{{end}}
 | 
			
		||||
{{if .RequireMinicolors}}
 | 
			
		||||
	<script src="{{AppSubUrl}}/plugins/jquery.minicolors-2.2.3/jquery.minicolors.min.js"></script>
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@
 | 
			
		||||
	<link rel="stylesheet" href="{{AppSubUrl}}/css/index.css?v={{MD5 AppVer}}">
 | 
			
		||||
 | 
			
		||||
{{if .RequireHighlightJS}}
 | 
			
		||||
	<link rel="stylesheet" href="{{AppSubUrl}}/plugins/highlight-9.6.0/github.css">
 | 
			
		||||
	<link rel="stylesheet" href="{{AppSubUrl}}/plugins/highlight-9.11.0/github.css">
 | 
			
		||||
{{end}}
 | 
			
		||||
{{if .RequireMinicolors}}
 | 
			
		||||
	<link rel="stylesheet" href="{{AppSubUrl}}/plugins/jquery.minicolors-2.2.3/jquery.minicolors.css">
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user