forked from mohsen1/json-formatter-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
92 lines (89 loc) · 2.36 KB
/
index.html
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<html>
<head>
<script defer src="dist/json-formatter.umd.js" charset="UTF-8"></script>
<script defer src="demo/index.js" charset="UTF-8"></script>
<style type="text/css">
body {
max-width: 800px;
margin: 20px auto;
font-family: sans-serif;
}
.gh {
text-align: right;
}
.result h3 + div {
border: 1px solid lightgray;
border-radius: 5px;
padding: 10px;
}
h1 code {
font-size: 2em;
}
pre {
font-size: 1.5rem;
background: #efefef;
padding: 1em;
}
textarea {
font-family: monospace;
}
</style>
</head>
<body>
<div class="intro">
<div class="gh">
<iframe
src="http://ghbtns.com/github-btn.html?user=mohsen1&repo=json-formatter-js&type=watch&size=large&count=true"
frameborder="0"
width="170"
height="30"
scrolling="0">
</iframe>
<iframe
src="http://ghbtns.com/github-btn.html?user=mohsen1&repo=json-formatter-js&type=fork&size=large&count=true"
frameborder="0"
width="170"
height="30"
scrolling="0">
</iframe>
</div>
<h1><code>JSONFormatter</code></h1>
<p>
Render JSON objects in HTML with a <b>collapsible</b> navigation.
</p>
<p><b><a href="https://github.com/mohsen1/json-formatter-js">JSON Formatter project on GitHub</a></b></p>
</div>
<h2>Usage</h2>
<div class="usage">
<p>Simple usage in ES6</p>
<pre>
import JSONFormatter from 'json-formatter-js'
const myJSON = {ans: 42};
const formatter = new JSONFormatter(myJSON);
document.body.appendChild(formatter.render());
</pre>
</div>
<h2>Playground</h2>
<div class="playground">
<p>Updating the JSON value in this textarea renders a new formatter on the right.</p>
<table>
<tr>
<td>
<textarea id="live" name="" id="" cols="30" rows="10">{"foo": 42}</textarea>
</td>
<td>
<div id="live-result"></div>
</td>
</tr>
<tr>
<p>
<input type="checkbox" id="hoverPreviewEnabled">
<label for="hoverPreviewEnabled"><code>hoverPreviewEnabled</code></label>
</p>
</tr>
</table>
</div>
<h2>Examples</h2>
<div class="result"></div>
</body>
</html>