Skip to content

a19836/code-beautifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Code Beautifier

Original Repos:

Overview

Code Beautifier is a javascript library to beautify PHP code, but it also works in other languages.

Check out a live example by opening index.html.


Usage

<html>
<head>
	<script src="js/MyCodeBeautifier.js"></script>
</head>
<body>
	<textarea class="textarea1" rows=20 style="width:100%;"></textarea>
	<textarea class="textarea2" rows=20 style="width:100%;"></textarea>
	<button onClick="beautify()">Beautify</button>
	
	<script>
		function beautify() {
			var code = $(".textarea1").val();
			var new_code = MyCodeBeautifier.prettyPrint(code);
			document.querySelector(".textarea2").value = new_code;
		}
	</script>
</body>
</html>