File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,15 @@ import {Utils} from "./Utils.js";
1010
1111export class Documentation {
1212
13+ static _escapeHtml ( unsafe ) {
14+ return unsafe
15+ . replace ( / & / g, "&" )
16+ . replace ( / < / g, "<" )
17+ . replace ( / > / g, ">" )
18+ . replace ( / " / g, """ )
19+ . replace ( / ' / g, "'" ) ;
20+ }
21+
1322 // formatting of the documentation is done as a regular output type
1423 // that is therefore in output.js
1524
@@ -412,8 +421,8 @@ export class Documentation {
412421
413422 if ( cmd . length >= 3 && cmd [ 0 ] === "modules" && cmd [ 1 ] === "beacons" && [ "add" , "modify" ] . indexOf ( cmd [ 2 ] ) >= 0 && argsArray . length >= 2 && typeof argsArray [ 1 ] === "string" ) {
414423 const beaconName = argsArray [ 1 ] ;
415- html += "<p>Beacon-name '" + beaconName + "' cannot be verified. We'll just assume it actually exists. The link below might not work.</p>" ;
416- html += "<p><a href='" + Documentation . DOCUMENTATION_URL + "beacons/all/salt.beacons." + beaconName + ".html' target='_blank' rel='noopener'>Beacon Module '" + beaconName + "'</a>" + Documentation . EXTERNAL_LINK + "</p>" ;
424+ html += "<p>Beacon-name '" + Documentation . _escapeHtml ( beaconName ) + "' cannot be verified. We'll just assume it actually exists. The link below might not work.</p>" ;
425+ html += "<p><a href='" + Documentation . DOCUMENTATION_URL + "beacons/all/salt.beacons." + Documentation . _escapeHtml ( beaconName ) + ".html' target='_blank' rel='noopener'>Beacon Module '" + Documentation . _escapeHtml ( beaconName ) + "'</a>" + Documentation . EXTERNAL_LINK + "</p>" ;
417426 }
418427
419428 const output = document . querySelector ( ".run-command pre" ) ;
You can’t perform that action at this time.
0 commit comments