requirejs-html-beautify.html
1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!doctype html>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.10/require.min.js"></script>
<script type="text/javascript">
require(["../lib/beautify-html"],function(html_beautify){
var input = document.getElementById("input").value;
var output = html_beautify.html_beautify(input);
document.getElementById("output").innerHTML = output;
});
</script>
<style type="text/css">
#output{
border: 1px solid black;
height: 300px;
width: 100%;
}
#input{
width: 100%;
height: 300px;
}
</style>
</head>
<body>
<h1>RequireJS test</h1>
<p>
This example loads the html-beautifier by using a relative path in the require call to the beautify-html.js file.
(also works works with absolute paths)
</p>
<pre>
require(["../lib/beautify-html"],function(html_beautify){
var input = document.getElementById("input").value;
var output = html_beautify.html_beautify(input);
document.getElementById("output").innerHTML = output;
});
</pre>
<h2>Input</h2>
<textarea name="" id="input">
<ul><li><a href="test"></a></li></ul>
</textarea>
<h2>Output</h2>
<textarea name="" id="output">
</textarea>
</body>
</html>