Skip to content

Commit 1f3e3d6

Browse files
✨ Sample HTML
1 parent b3f8f7b commit 1f3e3d6

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

index.html

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<!DOCTYPE html>
2+
<html lang="ja">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>HTMLCodeBlockElement</title>
8+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.1.0/styles/vs.min.css">
9+
<style>
10+
body {
11+
padding: 20px 20px 50vh;
12+
margin: 0 auto;
13+
max-width: 640px;
14+
font-family: sans-serif;
15+
background: #f1f1f1;
16+
}
17+
18+
h2:not(:first-of-type) {
19+
margin-top: 100px;
20+
}
21+
</style>
22+
<!-- <script src="./lib/html-code-block-element.core.min.js" defer></script> -->
23+
<script src="./lib/html-code-block-element.common.min.js" defer></script>
24+
<!-- <script src="./lib/html-code-block-element.all.min.js" defer></script> -->
25+
</head>
26+
<body>
27+
<main>
28+
<h1>HTMLCodeBlockElement</h1>
29+
30+
<h2>With escaped text</h2>
31+
32+
<h3>Source</h3>
33+
34+
<code-block language="html">
35+
<textarea><code-block language="html">
36+
&lt;script&gt;console.log(true);&lt;/script&gt;
37+
</code-block></textarea>
38+
</code-block>
39+
40+
<h3>Result</h3>
41+
42+
<code-block language="html">
43+
&lt;script&gt;console.log(true);&lt;/script&gt;
44+
</code-block>
45+
46+
<h2>With the textarea element</h2>
47+
48+
<h3>Source</h3>
49+
50+
<p><small><b>Note: </b>The textarea element cannot be included in the content of the textarea element. If you want to include it, please use HTML Entity for the tag.</small></p>
51+
52+
<code-block language="html">
53+
<textarea><code-block language="html">
54+
<textarea><script>console.log(true);</script>&lt;/textarea>
55+
</code-block></textarea>
56+
</code-block>
57+
58+
<h3>Result</h3>
59+
60+
<code-block language="html">
61+
<textarea><script>console.log(true);</script></textarea>
62+
</code-block>
63+
64+
<h2>PlayGround</h2>
65+
66+
<code-block language="js" id="cb">// this is placeholder</code-block>
67+
68+
<p>Let's run these JS on this page.</p>
69+
70+
<code-block language="js">
71+
<textarea>{
72+
const value = `<div>
73+
<h2>Hello world</h2>
74+
75+
<p>This is sample markup.</p>
76+
</div>`
77+
78+
cb.value = value;
79+
cb.language = 'html';
80+
}</textarea>
81+
</code-block>
82+
83+
<code-block language="js">
84+
<textarea>{
85+
const value = `{
86+
"items": [
87+
100,
88+
null,
89+
"this is sample json"
90+
]
91+
}`
92+
93+
cb.value = value;
94+
cb.language = 'json';
95+
}</textarea>
96+
</code-block>
97+
98+
</main>
99+
<script>
100+
window.cb = document.getElementById('cb');
101+
</script>
102+
</body>
103+
</html>

0 commit comments

Comments
 (0)