Skip to content

Latest commit

 

History

History
executable file
·
37 lines (28 loc) · 844 Bytes

File metadata and controls

executable file
·
37 lines (28 loc) · 844 Bytes

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>