Skip to content

Commit a74dfea

Browse files
committed
Use HTML code blocks
This is so that we can highlight code snippets using `<strong>` tags
1 parent 44ff380 commit a74dfea

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

extensions/ql-vscode/src/remote-queries/remote-queries-markdown-generation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ function generateMarkdownForInterpretedResult(interpretedResult: AnalysisAlert,
102102
function generateMarkdownForCodeSnippet(codeSnippet: string, language: string): MarkdownFile {
103103
const lines: MarkdownFile = [];
104104
lines.push(
105-
`\`\`\`${language}`,
105+
`<pre><code class="${language}">`,
106106
...codeSnippet.split('\n'),
107-
'```',
107+
'</code></pre>',
108108
);
109109
lines.push('');
110110
return lines;

extensions/ql-vscode/test/pure-tests/remote-queries/markdown-generation/interpreted-results/data/results-repo1.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,58 @@
22

33
[javascript/ql/src/Security/CWE-078/examples/shell-command-injection-from-environment.js](https://github.com/github/codeql/blob/48015e5a2e6202131f2d1062cc066dc33ed69a9b/javascript/ql/src/Security/CWE-078/examples/shell-command-injection-from-environment.js#L5-L5)
44

5-
```javascript
5+
<pre><code class="javascript">
66
function cleanupTemp() {
77
let cmd = "rm -rf " + path.join(__dirname, "temp");
88
cp.execSync(cmd); // BAD
99
}
1010

11-
```
11+
</code></pre>
1212

1313
*This shell command depends on an uncontrolled [absolute path](https://github.com/github/codeql/blob/48015e5a2e6202131f2d1062cc066dc33ed69a9b/javascript/ql/src/Security/CWE-078/examples/shell-command-injection-from-environment.js#L4-L4).*
1414

1515
----------------------------------------
1616

1717
[javascript/ql/test/query-tests/Security/CWE-078/tst_shell-command-injection-from-environment.js](https://github.com/github/codeql/blob/48015e5a2e6202131f2d1062cc066dc33ed69a9b/javascript/ql/test/query-tests/Security/CWE-078/tst_shell-command-injection-from-environment.js#L6-L6)
1818

19-
```javascript
19+
<pre><code class="javascript">
2020
(function() {
2121
cp.execFileSync('rm', ['-rf', path.join(__dirname, "temp")]); // GOOD
2222
cp.execSync('rm -rf ' + path.join(__dirname, "temp")); // BAD
2323

2424
execa.shell('rm -rf ' + path.join(__dirname, "temp")); // NOT OK
2525

26-
```
26+
</code></pre>
2727

2828
*This shell command depends on an uncontrolled [absolute path](https://github.com/github/codeql/blob/48015e5a2e6202131f2d1062cc066dc33ed69a9b/javascript/ql/test/query-tests/Security/CWE-078/tst_shell-command-injection-from-environment.js#L6-L6).*
2929

3030
----------------------------------------
3131

3232
[javascript/ql/test/query-tests/Security/CWE-078/tst_shell-command-injection-from-environment.js](https://github.com/github/codeql/blob/48015e5a2e6202131f2d1062cc066dc33ed69a9b/javascript/ql/test/query-tests/Security/CWE-078/tst_shell-command-injection-from-environment.js#L8-L8)
3333

34-
```javascript
34+
<pre><code class="javascript">
3535
cp.execSync('rm -rf ' + path.join(__dirname, "temp")); // BAD
3636

3737
execa.shell('rm -rf ' + path.join(__dirname, "temp")); // NOT OK
3838
execa.shellSync('rm -rf ' + path.join(__dirname, "temp")); // NOT OK
3939

4040

41-
```
41+
</code></pre>
4242

4343
*This shell command depends on an uncontrolled [absolute path](https://github.com/github/codeql/blob/48015e5a2e6202131f2d1062cc066dc33ed69a9b/javascript/ql/test/query-tests/Security/CWE-078/tst_shell-command-injection-from-environment.js#L8-L8).*
4444

4545
----------------------------------------
4646

4747
[javascript/ql/test/query-tests/Security/CWE-078/tst_shell-command-injection-from-environment.js](https://github.com/github/codeql/blob/48015e5a2e6202131f2d1062cc066dc33ed69a9b/javascript/ql/test/query-tests/Security/CWE-078/tst_shell-command-injection-from-environment.js#L9-L9)
4848

49-
```javascript
49+
<pre><code class="javascript">
5050

5151
execa.shell('rm -rf ' + path.join(__dirname, "temp")); // NOT OK
5252
execa.shellSync('rm -rf ' + path.join(__dirname, "temp")); // NOT OK
5353

5454
const safe = "\"" + path.join(__dirname, "temp") + "\"";
5555

56-
```
56+
</code></pre>
5757

5858
*This shell command depends on an uncontrolled [absolute path](https://github.com/github/codeql/blob/48015e5a2e6202131f2d1062cc066dc33ed69a9b/javascript/ql/test/query-tests/Security/CWE-078/tst_shell-command-injection-from-environment.js#L9-L9).*
5959

extensions/ql-vscode/test/pure-tests/remote-queries/markdown-generation/interpreted-results/data/results-repo2.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
[npm-packages/meteor-installer/install.js](https://github.com/meteor/meteor/blob/73b538fe201cbfe89dd0c709689023f9b3eab1ec/npm-packages/meteor-installer/install.js#L259-L259)
44

5-
```javascript
5+
<pre><code class="javascript">
66
if (isWindows()) {
77
//set for the current session and beyond
88
child_process.execSync(`setx path "${meteorPath}/;%path%`);
99
return;
1010
}
1111

12-
```
12+
</code></pre>
1313

1414
*This shell command depends on an uncontrolled [absolute path](https://github.com/meteor/meteor/blob/73b538fe201cbfe89dd0c709689023f9b3eab1ec/npm-packages/meteor-installer/config.js#L39-L39).*
1515

0 commit comments

Comments
 (0)