Skip to content

Instantly share code, notes, and snippets.

@neftaly
Created October 19, 2014 10:04
Show Gist options
  • Save neftaly/e8fde6c456f178f3b787 to your computer and use it in GitHub Desktop.
Save neftaly/e8fde6c456f178f3b787 to your computer and use it in GitHub Desktop.
Delete \t's in <pre> elements, so that HTML can be indented nicely. Use " " for intentional indents.
<!DOCTYPE html>
<html lang="en">
<head>
<script language="Javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script language="Javascript" src="//cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.js"></script>
<script language="Javascript">
$(document).ready(function() {
// Delete \t's in <pre> elements, so that HTML can be indented nicely. Use " " for intentional indents.
$("pre.prettyprint").text(function(index, text) {
return text.replace(/\t/g, "");
});
});
</script>
</head>
<body>
<pre class="prettyprint lang-js">
// This is an example
if (true) {
if (false) {
// Nested code
}
}
</pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment