|
5 | 5 | cross-origin-isolate |
6 | 6 | --> |
7 | 7 |
|
8 | | -<html> |
| 8 | +<!DOCTYPE html> |
9 | 9 |
|
10 | 10 |
|
11 | | - <head> |
| 11 | +<html> |
12 | 12 |
|
| 13 | + <head> |
| 14 | + <meta charset=utf-8> |
13 | 15 |
|
14 | | - <title>terminal in a webpage</title> |
| 16 | + <title> |
| 17 | + Terminal In A Webpage |
| 18 | + </title> |
15 | 19 |
|
| 20 | + <meta name=description content='Learn how to embed a fully interactive WebContainer-powered terminal directly into your webpage. This guide walks you through the setup and includes editable, runnable code so you can experiment with real Node.js environments right in the browser.'> |
16 | 21 | <base href='https://ext-code.com/blog/25-08-26/terminal-in-a-webpage/'> |
17 | | - <base href='https://javascript-2020.github.io/blog/25-08-26/terminal-in-a-webpage/'> |
18 | | - |
19 | 22 | <link rel=canonical href='https://ext-code.com/blog/25-08-26/terminal-in-a-webpage/terminal-in-a-webpage.html'> |
20 | | - |
21 | 23 | <link rel=icon type='image/png' href='/blog/image/blog-30.png'> |
| 24 | + <meta name=viewport content='width=device-width, initial-scale=1'> |
| 25 | + |
| 26 | + <script type='application/ld+json'> |
| 27 | + { |
| 28 | + "@context" : "https://schema.org", |
| 29 | + "@type" : "TechArticle", |
| 30 | + "headline" : "Terminal In A Webpage", |
| 31 | + "description" : "Learn how to embed a fully interactive WebContainer-powered terminal directly into your webpage. This guide walks you through the setup and includes editable, runnable code so you can experiment with real Node.js environments right in the browser.", |
| 32 | + "author" : {"@type":"Person","name":"Matthew Richards"}, |
| 33 | + "datePublished" : "2025-08-25", |
| 34 | + "dateModified" : "2025-10-29", |
| 35 | + "mainEntityOfPage" : {"@type":"WebPage","@id":"https://ext-code.com/blog/25-08-26/terminal-in-a-webpage/terminal-in-a-webpage.html"}, |
| 36 | + "publisher" : {"@type":"Organization","name":"Your Blog or Company Name","logo":{"@type":"ImageObject","url":"https://ext-code.com/favicon.ico"}}, |
| 37 | + } |
| 38 | + </script> |
22 | 39 |
|
23 | 40 |
|
24 | 41 | <script src='https://ajaxorg.github.io/ace-builds/src-noconflict/ace.js'></script> |
|
31 | 48 | console.log('terminal-in-a-webpage.html'); |
32 | 49 | console.log(); |
33 | 50 | console.json=v=>console.log(JSON.stringify(v,null,4)); |
34 | | - var df=true |
| 51 | + var df=true,version='v2.0' |
35 | 52 | ; |
36 | 53 |
|
37 | 54 |
|
38 | 55 | var ext; |
39 | 56 | var $; |
40 | 57 | var datatype; |
41 | | - var keydown; |
42 | 58 | var menumod; |
43 | | - var code; |
| 59 | + var keydown; |
44 | 60 | var debug; |
45 | 61 |
|
46 | 62 | var snippet; |
47 | 63 |
|
| 64 | + var log; |
| 65 | + |
48 | 66 |
|
49 | 67 | //: |
50 | 68 |
|
51 | 69 |
|
52 | | - mod.stack.add = init; |
53 | | - |
54 | 70 | async function init(){ |
55 | | - debug('init'); |
| 71 | + debug('init',version); |
56 | 72 | menu = menumod(); |
57 | 73 |
|
58 | 74 |
|
59 | 75 | snippet = mod['snippet-html-console']; |
| 76 | + log = mod.log; |
60 | 77 |
|
61 | 78 | snippet.initmod({ext,$,menu,ace}); |
| 79 | + log.initmod({ext,$}); |
62 | 80 |
|
63 | | - await snippet.init(); |
| 81 | + await Promise.all([ |
| 82 | + snippet.init(), |
| 83 | + log.init(), |
| 84 | + ]); |
64 | 85 |
|
65 | 86 |
|
66 | | - await initdom(document.body); |
| 87 | + initdom(document.body); |
67 | 88 |
|
68 | 89 |
|
69 | 90 | }//init |
|
83 | 104 | 'js/core/datatype.js', |
84 | 105 | 'js/dom/menumod/menumod.js', |
85 | 106 | 'js/dom/keydown/keydown.js', |
86 | | - 'js/dom/code/v2.0/code-v2.0.js.api', |
87 | 107 | 'js/debug/debug.js', |
88 | 108 | ); |
89 | | - [$,datatype,menumod,keydown,code,debug] = await promise; |
| 109 | + [$,datatype,menumod,keydown,debug] = await promise; |
90 | 110 |
|
91 | | - code.initmod({ext,$,datatype,menumod}); |
92 | | - |
93 | 111 | mod.stack.complete; |
94 | 112 |
|
95 | 113 | })(); |
96 | 114 |
|
97 | 115 |
|
98 | 116 | </script init> |
99 | | - |
100 | 117 |
|
101 | 118 |
|
102 | 119 | <link rel=stylesheet href='/blog/css/blog.css'> |
103 | 120 |
|
104 | 121 | <style> |
| 122 | + |
105 | 123 |
|
106 | 124 | html |
107 | | - {height:100%} |
| 125 | + {height:100%;font-family:arial} |
108 | 126 | body |
109 | | - {min-height:calc(100% - 40px);display:flex;flex-direction:column;gap:10px;margin:20px;align-items:center; |
110 | | - font-family:arial |
| 127 | + {min-height:calc(100% - 40px);display:flex;flex-direction:column;gap:20px;margin:20px;align-items:center; |
| 128 | + padding-bottom:200px; |
111 | 129 | } |
112 | 130 | body>* |
113 | | - {max-width:1400px;width:100%;padding:0 20px;} |
| 131 | + {max-width:1400px;width:100%} |
| 132 | + |
| 133 | + [component] |
| 134 | + {display:none} |
| 135 | + |
| 136 | + .description |
| 137 | + {max-width:1000px;text-align:justify;border-left:4px solid #4a90e2;padding:1rem 2rem; |
| 138 | + background-color:#f9f9f9;font-family:system-ui,sans-serif;font-size:1rem;line-height:1.6;color:#333} |
| 139 | + .description>p |
| 140 | + {margin:0} |
| 141 | + .description > p+p |
| 142 | + {margin:10px 0} |
| 143 | + |
| 144 | + code |
| 145 | + {font-family:monospace;background:whitesmoke} |
| 146 | + code.inline |
| 147 | + {display:inline;padding:5px 10px} |
| 148 | + |
| 149 | + a |
| 150 | + {color:#4a90e2;text-decoration:none;font-weight:500} |
| 151 | + a:hover |
| 152 | + {text-decoration:underline} |
| 153 | + .link-domain |
| 154 | + {font-size:0.85rem;color:#777;margin-left:0.25rem} |
| 155 | + .link-domain::before |
| 156 | + {content:'['} |
| 157 | + .link-domain::after |
| 158 | + {content:']'} |
| 159 | + .link-txt |
| 160 | + {} |
| 161 | + |
| 162 | + input |
| 163 | + {font-size:16px;padding:5px 7px;box-sizing:border-box;} |
| 164 | + input[type=button] |
| 165 | + {cursor:pointer} |
| 166 | + |
| 167 | + |
114 | 168 |
|
115 | 169 | </style> |
116 | 170 |
|
117 | | - |
118 | | - |
119 | 171 | </head> |
120 | 172 |
|
121 | 173 |
|
122 | 174 | <body> |
123 | 175 |
|
124 | | - |
125 | | - |
126 | | - <h3> |
127 | | - terminal in a webpage |
128 | | - </h3> |
| 176 | + <blog-hdr component=grp1 v2.0> |
| 177 | + <h1 class=title> |
| 178 | + Terminal In A Webpage |
| 179 | + </h1> |
| 180 | + <time slot=date datetime=2025-10-29> |
| 181 | + 29 Oct 2025 |
| 182 | + </time> |
| 183 | + </blog-hdr> |
129 | 184 |
|
130 | 185 |
|
131 | | - <div id=desc> |
132 | | - terminal in a webpage |
| 186 | + |
| 187 | + <div class=description> |
| 188 | + <p> |
| 189 | + Learn how to embed a fully interactive WebContainer-powered terminal directly into your webpage. |
| 190 | + This guide walks you through the setup and includes editable, runnable code so you can experiment with real Node.js environments right in the browser. |
| 191 | + </p> |
133 | 192 | </div> |
134 | 193 |
|
135 | 194 |
|
136 | | - <snippet-html-console component v2.0 src='ex/ex.html'> |
137 | | - </snippet-html-console> |
| 195 | + <snippet-html-console component v2.0 src='ex/ex.html'></snippet-html-console> |
| 196 | + |
| 197 | + |
| 198 | + <log component v2.0></log> |
138 | 199 |
|
139 | 200 |
|
140 | 201 | </body> |
|
150 | 211 |
|
151 | 212 | snippet.initdom(root); |
152 | 213 | snippet.console.height = 200; |
| 214 | + |
| 215 | + |
| 216 | + log.initdom(); |
153 | 217 |
|
154 | 218 |
|
155 | 219 | }//initdom |
|
0 commit comments