Adds support for auto escaping HTML in code blocks.
This commit is contained in:
		
							
								
								
									
										12
									
								
								js/reveal.js
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								js/reveal.js
									
									
									
									
									
								
							| @@ -235,6 +235,18 @@ var Reveal = (function(){ | |||||||
| 			dom.controlsNext = toArray( document.querySelectorAll( '.navigate-next' ) ); | 			dom.controlsNext = toArray( document.querySelectorAll( '.navigate-next' ) ); | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
|  | 		//Auto scape code blocks | ||||||
|  | 		var cblocks = document.querySelectorAll("pre code"); | ||||||
|  | 		 | ||||||
|  | 		if(cblocks.length) { | ||||||
|  | 			for(var i=0, len=cblocks.length; i<len; i++) { | ||||||
|  | 				var thisDom = cblocks[i]; | ||||||
|  | 				var html = thisDom.innerHTML; | ||||||
|  | 				html = html.replace(/</g,"<").replace(/>/g,">"); | ||||||
|  | 				thisDom.innerHTML = html; | ||||||
|  | 			} | ||||||
|  | 		}		 | ||||||
|  |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** | 	/** | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user