Skip to content

Commit

Permalink
feat(theme): support parent item clickable in user defined ToC for He…
Browse files Browse the repository at this point in the history
…xo theme
  • Loading branch information
ourai committed Apr 10, 2024
1 parent d695233 commit f1b0064
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
<% const _inc_docs = (site.data[`knosys/${repo}`] || {}).items %>
<% const _inc_base_part = base || '' %>
<% const _inc_base_url = `${_inc_site_url}${_inc_base_part}` %>
<% if (_inc_item.items) { %>
<span><%= _inc_item.text %></span>
<%- partial('_nop/components/doc-toc', { repo, items: _inc_item.items, base: _inc_base_part, collection: _inc_collection }) %>
<% } else { %>
<% if (customized ? _inc_item.slug !== undefined : !_inc_item.items) { %>
<% const _inc_relative_url = page.path.replace('/index.html', '/').replace(base ? new RegExp(`^${_inc_base_part}`) : '', '') %>
<% let _inc_item_url = `/${_inc_collection}/` %>
<% let _inc_doc_url = `${_inc_base_url}/${_inc_collection}` %>
Expand All @@ -23,6 +20,11 @@
<% _inc_doc_url = `${_inc_doc_url}/${_inc_item.slug}/` %>
<% } %>
<a data-re="<%= _inc_relative_url %>" data-uuu="<%= _inc_item_url %>"<% if (_inc_relative_url === _inc_item_url) { %> class="is-selected"<% } %> href="<%= _inc_doc_url %>"><%= _inc_item.text %></a>
<% } else { %>
<span><%= _inc_item.text %></span>
<% } %>
<% if (_inc_item.items) { %>
<%- partial('_nop/components/doc-toc', { repo, items: _inc_item.items, base: _inc_base_part, collection: _inc_collection, customized }) %>
<% } %>
</li>
<% }) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<% if (repo && repo.toc) { %>
<aside class="Page-aside">
<div class="AsideBrand"><%- partial('_ksio/components/brand-link', { className: '' }) %></div>
<nav class="AsideNav"><%- partial('_nop/components/doc-toc', { repo: page.repo, items: repo.toc, base: repo.base, collection: repo.collection }) %></nav>
<nav class="AsideNav"><%- partial('_nop/components/doc-toc', { repo: page.repo, items: repo.toc, base: repo.base, collection: repo.collection, customized: repo.customized === true }) %></nav>
</aside>
<% } %>
<main class="Page-main">
Expand Down

0 comments on commit f1b0064

Please sign in to comment.