Skip to content

Instantly share code, notes, and snippets.

@likev
Created March 12, 2024 02:09
Show Gist options
  • Save likev/adfccbabe2894fac13085b6db596a41c to your computer and use it in GitHub Desktop.
Save likev/adfccbabe2894fac13085b6db596a41c to your computer and use it in GitHub Desktop.
Add table of contents to Julia Documentation https://docs.julialang.org
function add_table_of_contents() {
let ul = $('<ul class="table-of-contents">'),
lis = '';
$('#documenter-page article.docstring>header').each(function(index, e) {
let link = $(this).find('a').attr('href');
let link_html = `<li><a href='${link}'>${$(this).text()}</a></li>`
//console.log(link_html)
lis += link_html;
})
ul.append(lis).css({
position: 'fixed',
right: '1em',
top: '4em',
'max-height': '80%',
'overflow-y': 'auto',
padding: '1em 0'
});
$('body>ul.table-of-contents').remove()
$('body').append(ul)
}
add_table_of_contents()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment