From 71068265a25fb5d4c1ce80fc2d59fb596ebe5b42 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Fri, 29 Nov 2024 15:49:34 +0100 Subject: [PATCH 1/2] custom.js/search: Fix how parents are moved from title to category --- docs/js/custom.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/js/custom.js b/docs/js/custom.js index 6793bfbe4d..f3720c286b 100644 --- a/docs/js/custom.js +++ b/docs/js/custom.js @@ -153,11 +153,11 @@ $(document).ready(function() { const category = $(element).find('.algolia-docsearch-suggestion--subcategory-column-text'); category.append(separatorHtml); if (title.find('.' + separatorClass).length) { - $.each(title.contents(), (i, e) => { - if (title.contents().length > 1) { - $(e).appendTo(category); - } - }); + const titleParts = title.html().split(separatorHtml); + for (let i = 0; i < titleParts.length-2; i++) { + $(titleParts[i]).appendTo(category); + } + title.html(titleParts[titleParts.length-1]); } if (separatorText != category.text().trim().slice(-1)) { category.append(separatorHtml); From f735fbbd302cd9bf3e2fce73d8a23cb26ac115c5 Mon Sep 17 00:00:00 2001 From: Adrien Dupuis <61695653+adriendupuis@users.noreply.github.com> Date: Fri, 29 Nov 2024 16:15:51 +0100 Subject: [PATCH 2/2] custom.js/search: Fix how parents are moved from title to category --- docs/js/custom.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/js/custom.js b/docs/js/custom.js index f3720c286b..28f4f03fd9 100644 --- a/docs/js/custom.js +++ b/docs/js/custom.js @@ -23,7 +23,7 @@ $(document).ready(function() { 'href', $(this) .attr('href') - .replace('master/docs/', branchName + '/docs/') + .replace('master/docs/', branchName + '/docs/'), ); }); @@ -154,10 +154,10 @@ $(document).ready(function() { category.append(separatorHtml); if (title.find('.' + separatorClass).length) { const titleParts = title.html().split(separatorHtml); - for (let i = 0; i < titleParts.length-2; i++) { - $(titleParts[i]).appendTo(category); + for (let i = 0; i < titleParts.length - 1; i++) { + category.html(category.html() + titleParts[i] + separatorHtml); } - title.html(titleParts[titleParts.length-1]); + title.html(titleParts[titleParts.length - 1]); } if (separatorText != category.text().trim().slice(-1)) { category.append(separatorHtml); @@ -209,7 +209,7 @@ $(document).ready(function() { if ($('.md-sidebar--secondary .md-nav__link--active').length) { $('.md-sidebar--secondary .md-nav__link--active')[0].scrollIntoView({ behavior: 'instant', - block: 'nearest' + block: 'nearest', }); } else { $('.md-sidebar--secondary .md-sidebar__scrollwrap').scrollTop(0);