Skip to content

Commit

Permalink
Merge pull request #428 from trilitech/fix-glossary-heading-hash
Browse files Browse the repository at this point in the history
Fix hash for glossary headings
  • Loading branch information
timothymcmackin authored Aug 7, 2024
2 parents 2de16fe + cd69a55 commit 69d3a90
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/scripts/process_downloaded_glossary.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ const process_glossary = async () => {
}
});

// Convert section header links to match the rest of the site
const sectionHeaderLinks = trimmed.querySelectorAll('a.headerlink');
sectionHeaderLinks.forEach((link) => {
link.setAttribute('class', 'hash-link');
const title = link.parentNode.firstChild.textContent;
link.setAttribute('aria-label', 'Direct link to ' + title);
link.setAttribute('title', 'Direct link to ' + title);
link.textContent = '';
});

// Wrap with <div class='imported-glossary'></div> to apply custom styles
const wrapper = new JSDOM('<div id="imported-glossary"></div>');
const imported_glossary = wrapper.window.document.querySelector('div#imported-glossary');
Expand Down

0 comments on commit 69d3a90

Please sign in to comment.