Skip to content

Commit 9550e30

Browse files
Merge pull request #427 from ossf/pre_code3
Pre code3
2 parents de41b79 + 97e5aee commit 9550e30

File tree

5 files changed

+33
-13
lines changed

5 files changed

+33
-13
lines changed

docs/labs/checker.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
pre, pre code, pre input, pre textarea {
2+
font-family: "SFMono-Regular", Consolas, "Liberation Mono",
3+
Menlo, Courier, monospace;
4+
font-size: 16px;
5+
}
6+
pre input, pre textarea {
7+
/* Line up with text surrounding text */
8+
margin-left: -5px;
9+
}

docs/labs/csp1.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
<meta http-equiv="X-UA-Compatible" content="IE=edge">
44
<meta name="viewport" content="width=device-width, initial-scale=1">
55
<link rel="stylesheet" href="/assets/css/style.css">
6+
<link rel="stylesheet" href="checker.css">
67
<script src="js-yaml.min.js"></script>
78
<script src="checker.js"></script>
9+
<link rel="license" href="https://creativecommons.org/licenses/by/4.0/">
810

911
<!-- See create_labs.md for how to create your own lab! -->
1012

@@ -387,7 +389,8 @@ <h2>Interactive Lab (<span id="grade"></span>)</h2>
387389
<pre><code>
388390
const express = require("express");
389391
<input id="attempt0" type="text" size="70" spellcheck="false"
390-
value="const">
392+
value="const">
393+
</textarea>
391394

392395
const app = express();
393396

docs/labs/hello.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
<meta http-equiv="X-UA-Compatible" content="IE=edge">
44
<meta name="viewport" content="width=device-width, initial-scale=1">
55
<link rel="stylesheet" href="/assets/css/style.css">
6+
<link rel="stylesheet" href="checker.css">
67
<script src="js-yaml.min.js"></script>
78
<script src="checker.js"></script>
9+
<link rel="license" href="https://creativecommons.org/licenses/by/4.0/">
810

911
<!-- See create_labs.md for how to create your own lab! -->
1012

@@ -83,7 +85,7 @@
8385
# ADVANCED use - define our own preprocessing commands.
8486
# I suggest using "|-" (stripping the trailing newlines)
8587
# preprocessing:
86-
# -
88+
# -
8789
# - |-
8890
# [\n\r]+
8991
# - ""
@@ -146,10 +148,10 @@ <h2>Interactive Lab (<span id="grade"></span>)</h2>
146148
<textarea id="attempt" rows="2" cols="70">...</textarea>
147149
-->
148150
<form id="lab">
149-
<pre>
150-
<input id="attempt0" type="text" size="70"
151+
<pre><code>
152+
<input id="attempt0" type="text" size="70" spellcheck="false"
151153
value='console.log("Goodbye.");'>
152-
</pre>
154+
</code></pre>
153155
<button type="button" id="hintButton">Hint</button>
154156
<button type="button" id="resetButton">Reset</button>
155157
<button type="button" id="giveUpButton">Give up</button>

docs/labs/input1.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
<meta http-equiv="X-UA-Compatible" content="IE=edge">
44
<meta name="viewport" content="width=device-width, initial-scale=1">
55
<link rel="stylesheet" href="/assets/css/style.css">
6+
<link rel="stylesheet" href="checker.css">
67
<script src="js-yaml.min.js"></script>
78
<script src="checker.js"></script>
9+
<link rel="license" href="https://creativecommons.org/licenses/by/4.0/">
810

911
<!-- See create_labs.md for how to create your own lab! -->
1012

@@ -85,7 +87,7 @@
8587
# ADVANCED use - define our own preprocessing commands.
8688
# I suggest using "|-" (stripping the trailing newlines)
8789
# preprocessing:
88-
# -
90+
# -
8991
# - |-
9092
# [\n\r]+
9193
# - ""
@@ -200,15 +202,16 @@ <h2>Interactive Lab (<span id="grade"></span>)</h2>
200202
<textarea id="attempt" rows="2" cols="70">...</textarea>
201203
-->
202204
<form id="lab">
203-
<pre>
205+
<pre></code>
204206
// Set up Express framework and express-validator library
205207
const express = require("express");
206208
const app = express();
207209
const { query, matchedData, validationResult } = require('express-validator');
208210

209211
// Implement requests such as http://localhost:3000/invoices?id=1
210212
app.get('/invoices',
211-
<input id="attempt0" type="text" size="70" value=" query('id'),">
213+
<input id="attempt0" type="text" size="70" spellcheck="false"
214+
value=" query('id'),">
212215
(req, res) =&gt; { // Execute this code if /invoices seen
213216
const result = validationResult(req); // Retrieve errors
214217
if (result.isEmpty()) { // No errors
@@ -217,7 +220,7 @@ <h2>Interactive Lab (<span id="grade"></span>)</h2>
217220
}
218221
res.status(422).send(`Invalid input`);
219222
})
220-
</pre>
223+
</code></pre>
221224
<button type="button" id="hintButton">Hint</button>
222225
<button type="button" id="resetButton">Reset</button>
223226
<button type="button" id="giveUpButton">Give up</button>

docs/labs/input2.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
<meta http-equiv="X-UA-Compatible" content="IE=edge">
44
<meta name="viewport" content="width=device-width, initial-scale=1">
55
<link rel="stylesheet" href="/assets/css/style.css">
6+
<link rel="stylesheet" href="checker.css">
67
<script src="js-yaml.min.js"></script>
78
<script src="checker.js"></script>
9+
<link rel="license" href="https://creativecommons.org/licenses/by/4.0/">
810

911
<!-- Sample expected answer -->
1012
<script id="expected0" type="plain/text">
@@ -111,7 +113,7 @@ <h2>Background</h2>
111113

112114
<p>
113115
However, this time we're going to do input validation for a specific
114-
data value using regular expressions. Many programs have
116+
data value using regular expressions. Many programs have
115117
specialized data values that are easily tested using
116118
regular expressions.
117119

@@ -191,15 +193,16 @@ <h2>Interactive Lab (<span id="grade"></span>)</h2>
191193
<textarea id="attempt" rows="2" cols="70">...</textarea>
192194
-->
193195
<form id="lab">
194-
<pre>
196+
<pre><code>
195197
// Set up Express framework and express-validator library
196198
const express = require("express");
197199
const app = express();
198200
const { query, matchedData, validationResult } = require('express-validator');
199201

200202
// Implement requests such as http://localhost:3000/parts?id=1
201203
app.get('/parts',
202-
<input id="attempt0" type="text" size="70" value=" ,">
204+
<input id="attempt0" type="text" size="70" spellcheck="false"
205+
value=" ,">
203206
(req, res) =&gt; { // Execute this code if /invoices seen
204207
const result = validationResult(req); // Retrieve errors
205208
if (result.isEmpty()) { // No errors
@@ -208,7 +211,7 @@ <h2>Interactive Lab (<span id="grade"></span>)</h2>
208211
}
209212
res.status(422).send(`Invalid input`);
210213
})
211-
</pre>
214+
</code></pre>
212215
<button type="button" id="hintButton">Hint</button>
213216
<button type="button" id="resetButton">Reset</button>
214217
<button type="button" id="giveUpButton">Give up</button>

0 commit comments

Comments
 (0)