Skip to content

Commit

Permalink
Fix hash for glossary headings
Browse files Browse the repository at this point in the history
  • Loading branch information
timothymcmackin committed Aug 1, 2024
1 parent 2de16fe commit df6eb6a
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 df6eb6a

Please sign in to comment.