Skip to content

Commit

Permalink
Merge branch 'main' of github.com:refaktor/rye into multiliner
Browse files Browse the repository at this point in the history
  • Loading branch information
refaktor committed Jan 3, 2025
2 parents 02af52d + eefafae commit f21e765
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions info/tpl/jsGoo.js
Original file line number Diff line number Diff line change
Expand Up @@ -1049,9 +1049,9 @@ function HTMLDecode(s) {
s = s.replace(/'/g,"'");
s = s.replace(///g,"/");
s = s.replace(/"/g,'"');
s = s.replace(/&/g,"&");
s = s.replace(/&lt;/g,"<");
return s.replace(/&gt;/g,">");
s = s.replace(/&gt;/g,">");
return s.replace(/&amp;/g,"&");
}

//utils-shortcuts -- remove if you need to
Expand Down
13 changes: 12 additions & 1 deletion info/tpl/menu.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
function escapeHtml(text) {
const map = {
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#039;'
};
return text.replace(/[&<>"']/g, function(m) { return map[m]; });
}

function generateMenuFromHeadings(node, hh) {
// Select all H2 elements
const h2Elements = node.querySelectorAll(hh);
Expand All @@ -14,7 +25,7 @@ function generateMenuFromHeadings(node, hh) {
// menuItem.textContent = h2.textContent;

// Optionally, set an id on the H2 for navigation
var index = h2.textContent;
var index = escapeHtml(h2.textContent);

const h2Id = `heading-${index}`;
h2.setAttribute('id', h2Id);
Expand Down

0 comments on commit f21e765

Please sign in to comment.