We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a81a861 commit 3cbcda5Copy full SHA for 3cbcda5
docs/themes/v2/source/js/code-tabs.js
@@ -31,6 +31,18 @@ Test 1!
31
32
33
34
+function escapeHTML(str) {
35
+ return str.replace(/[&<>"']/g, function (char) {
36
+ return {
37
+ '&': '&',
38
+ '<': '<',
39
+ '>': '>',
40
+ '"': '"',
41
+ "'": '''
42
+ }[char];
43
+ });
44
+}
45
+
46
function openCodeTab(id, event) {
47
const tabObj = document.querySelector(`${'#' + id}`);
48
const anchorObj = document.querySelector(`${'#' + id + '-anchor'}`);
@@ -75,7 +87,7 @@ function openCodeTab(id, event) {
75
87
'class="Heading XXSmall"' +
76
88
'onclick="openCodeTab(\'' + id + '\', event)" ' +
77
89
'href="#' + id + '-anchor">' +
78
- name +
90
+ escapeHTML(name) +
79
91
'</a>';
80
92
})
81
93
0 commit comments