Skip to content

Commit 7e74211

Browse files
committed
doc: use pre>code instead of just pre (#33)
1 parent 9213679 commit 7e74211

File tree

4 files changed

+34
-34
lines changed

4 files changed

+34
-34
lines changed

docs/browser-only.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ Note that WASI-based playgrounds (`engine` = `wasi` in the examples below) requi
1717
Executes the code using the [AsyncFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction).
1818

1919
```html
20-
<pre>
20+
<pre><code>
2121
const msg = "Hello, World!"
2222
console.log(msg)
23-
</pre>
23+
</code></pre>
2424

2525
<codapi-snippet engine="browser" sandbox="javascript" editor="basic"></codapi-snippet>
2626
```
@@ -32,14 +32,14 @@ console.log(msg)
3232
Executes the code using the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API).
3333

3434
```html
35-
<pre>
35+
<pre><code>
3636
POST https://httpbingo.org/dump/request
3737
content-type: application/json
3838

3939
{
4040
"message": "hello"
4141
}
42-
</pre>
42+
</code></pre>
4343

4444
<codapi-snippet engine="browser" sandbox="fetch" editor="basic"></codapi-snippet>
4545
```
@@ -51,10 +51,10 @@ content-type: application/json
5151
Executes the code using the [Lua WASI runtime](https://github.com/nalgeon/lua-wasi) (330 KB).
5252

5353
```html
54-
<pre>
54+
<pre><code>
5555
local msg = "Hello, World!"
5656
print(msg)
57-
</pre>
57+
</code></pre>
5858

5959
<codapi-snippet engine="wasi" sandbox="lua" editor="basic"></codapi-snippet>
6060
```
@@ -66,12 +66,12 @@ print(msg)
6666
Executes the code using the [PHP WASI runtime](https://github.com/nalgeon/php-wasi) (13.2 MB).
6767

6868
```html
69-
<pre>
69+
<pre><code>
7070
&lt;?php
7171
$msg = "Hello, World!";
7272
echo $msg;
7373
?&gt;
74-
</pre>
74+
</code></pre>
7575

7676
<codapi-snippet engine="wasi" sandbox="php" editor="basic"></codapi-snippet>
7777
```
@@ -83,11 +83,11 @@ echo $msg;
8383
Executes the code using the [PGlite runtime](https://github.com/electric-sql/pglite) (12 MB).
8484

8585
```html
86-
<pre>
86+
<pre><code>
8787
create table data(message text);
8888
insert into data values ('Hello, World!');
8989
select * from data;
90-
</pre>
90+
</code></pre>
9191

9292
<codapi-snippet engine="pglite" sandbox="postgres" editor="basic" output-mode="table">
9393
</codapi-snippet>
@@ -111,10 +111,10 @@ Note that this playground requires additional scripts besides the usual `snippet
111111
Executes the code using the [Python WASI runtime](https://github.com/nalgeon/python-wasi) (26.3 MB).
112112

113113
```html
114-
<pre>
114+
<pre><code>
115115
msg = "Hello, World!"
116116
print(msg)
117-
</pre>
117+
</code></pre>
118118

119119
<codapi-snippet engine="wasi" sandbox="python" editor="basic"></codapi-snippet>
120120
```
@@ -126,10 +126,10 @@ print(msg)
126126
Executes the code using the [Ruby WASI runtime](https://github.com/nalgeon/ruby-wasi) (24.5 MB).
127127

128128
```html
129-
<pre>
129+
<pre><code>
130130
msg = "Hello, World!"
131131
puts msg
132-
</pre>
132+
</code></pre>
133133

134134
<codapi-snippet engine="wasi" sandbox="ruby" editor="basic"></codapi-snippet>
135135
```
@@ -141,9 +141,9 @@ puts msg
141141
Executes the code using the [SQLite WASI runtime](https://github.com/nalgeon/sqlite-wasi) (2.1 MB).
142142

143143
```html
144-
<pre>
144+
<pre><code>
145145
select "Hello, World!" as message;
146-
</pre>
146+
</code></pre>
147147

148148
<codapi-snippet engine="wasi" sandbox="sqlite" editor="basic"></codapi-snippet>
149149
```

docs/files.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ def greet(name):
2020
2. Create a snippet with the actual code:
2121

2222
```html
23-
<pre>
23+
<pre><code>
2424
import npc
2525
npc.greet("Alice")
26-
</pre>
26+
</code></pre>
2727

2828
<codapi-snippet sandbox="python" files="npc.py"></codapi-snippet>
2929
```
@@ -48,10 +48,10 @@ def greet(name):
4848
print(f"Hello, {name}")
4949
</script>
5050

51-
<pre>
51+
<pre><code>
5252
import npc
5353
npc.greet("Alice")
54-
</pre>
54+
</code></pre>
5555

5656
<codapi-snippet sandbox="python" files="#npc.py"></codapi-snippet>
5757
```
@@ -61,17 +61,17 @@ The use of `id` and `#` is mandatory; you can't select files based on CSS classe
6161
You can also use another `codapi-snippet` instead of a script:
6262

6363
```html
64-
<pre>
64+
<pre><code>
6565
def greet(name):
6666
print(f"Hello, {name}")
67-
</pre>
67+
</code></pre>
6868

6969
<codapi-snippet id="npc.py" sandbox="python"></codapi-snippet>
7070

71-
<pre>
71+
<pre><code>
7272
import npc
7373
npc.greet("Alice")
74-
</pre>
74+
</code></pre>
7575

7676
<codapi-snippet sandbox="python" files="#npc.py"></codapi-snippet>
7777
```
@@ -81,10 +81,10 @@ npc.greet("Alice")
8181
You can set a different name for a file using `:`:
8282

8383
```html
84-
<pre>
84+
<pre><code>
8585
import greeter
8686
greeter.greet("Alice")
87-
</pre>
87+
</code></pre>
8888

8989
<codapi-snippet sandbox="python" files="npc.py:greeter.py"></codapi-snippet>
9090
```

docs/html.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ Here is how to embed interactive code snippets into your HTML or Markdown pages:
1818
Let's start with a simple use case. Suppose you have a static code snippet in Python:
1919

2020
```html
21-
<pre>
21+
<pre><code>
2222
msg = "Hello, World!"
2323
print(msg)
24-
</pre>
24+
</code></pre>
2525
```
2626

2727
To make it interactive, add a `codapi-snippet` element right after the `pre` element:
2828

2929
```html
30-
<pre>
30+
<pre><code>
3131
msg = "Hello, World!"
3232
print(msg)
33-
</pre>
33+
</code></pre>
3434

3535
<codapi-snippet sandbox="python" editor="basic"></codapi-snippet>
3636
```

docs/templates.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ func main() {
3434
2. Create a snippet with the actual code:
3535

3636
```html
37-
<pre>
37+
<pre><code>
3838
msg = "Hello, World!"
3939
fmt.Println(msg)
40-
</pre>
40+
</code></pre>
4141

4242
<codapi-snippet sandbox="go" editor="basic" template="main.go">
4343
</codapi-snippet>
@@ -57,9 +57,9 @@ def greet(name):
5757
##CODE##
5858
</script>
5959

60-
<pre>
60+
<pre><code>
6161
greet("World")
62-
</pre>
62+
</code></pre>
6363

6464
<codapi-snippet sandbox="python" template="#main.py"></codapi-snippet>
6565
```

0 commit comments

Comments
 (0)