mirror of
				https://github.com/go-gitea/gitea
				synced 2025-10-31 19:38:23 +00:00 
			
		
		
		
	- introduced window.config to help with js-based lazy-loading - adjusted webpack chunk naming to avoid 'vendors~name.js' that webpack defaults to for vendor chunks. - added theme class to html and prefixed all selectors. this is neccesary so that the theme styles win over the lazy-loaded ones. Co-authored-by: zeripath <art27@cantab.net>
		
			
				
	
	
		
			13 lines
		
	
	
		
			366 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			366 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| export default async function initHighlight() {
 | |
|   if (!window.config || !window.config.HighlightJS) return;
 | |
| 
 | |
|   const hljs = await import(/* webpackChunkName: "highlight" */'highlight.js');
 | |
| 
 | |
|   const nodes = [].slice.call(document.querySelectorAll('pre code') || []);
 | |
|   for (let i = 0; i < nodes.length; i++) {
 | |
|     hljs.highlightBlock(nodes[i]);
 | |
|   }
 | |
| 
 | |
|   return hljs;
 | |
| }
 |