<% if (note.hasLabel("shareDescription")) { %> "> <% } %> <% if (note.hasRelation("shareFavicon")) { %> /download"> <% } else { %> <% } %> <% if (!note.hasLabel("shareOmitDefaultCss")) { %> <% } %> <% if (note.hasLabel("shareSwagger")) { %> <% } %> <% if (note.type === 'text' || note.type === 'book') { %> <% } %> <% for (const cssRelation of note.getRelations("shareCss")) { %> <% } %> <% for (const jsRelation of note.getRelations("shareJs")) { %> <% } %> <% if (note.hasLabel('shareDisallowRobotIndexing')) { %> <% } %> <%- header %> <%= note.title %><% if (note.noteId !== subRoot.noteId) { %> - <%= subRoot.title %><% } %> "> "> <% const currentTheme = note.getLabel("shareTheme") === "light" ? "light" : "dark"; const themeClass = currentTheme === "light" ? " theme-light" : " theme-dark"; const headingRe = /()(.+?)(<\/h[1-6]>)/g; const headingMatches = [...content.matchAll(headingRe)]; const slugify = (text) => text.toLowerCase().replace(/[^\w]/g, "-"); content = content.replaceAll(headingRe, (...match) => { match[0] = match[0].replace(match[3], `#${match[3]}`); return match[0]; }); %>
<% if (subRoot.hasRelation("shareLogo")) { %> /download" alt="Logo" /> <% } %> <%= subRoot.title %>

<%= note.title %>

<% if (isEmpty && (!note.hasVisibleChildren() && note.type !== "book")) { %>

This note has no content.

<% } else { %> <%- content %> <% } %>
<% if (note.hasVisibleChildren() || note.type === "book") { %> <% } %>
<% if (headingMatches.length > 1) { const level = (m) => parseInt(m[1].replace(/[]+/g, "")); const toc = [ { level: level(headingMatches[0]), name: headingMatches[0][2], children: [] } ]; const last = (arr = toc) => arr[arr.length - 1]; const makeEntry = (m) => ({level: level(m), name: m[2], children: []}); const getLevelArr = (lvl, arr = toc) => { if (arr[0].level === lvl) return arr; const top = last(arr); return top.children.length ? getLevelArr(lvl, top.children) : top.children; }; for (let m = 1; m < headingMatches.length; m++) { const target = getLevelArr(level(headingMatches[m])); target.push(makeEntry(headingMatches[m])); } %>

On This Page

    <% let active = true; for (const entry of toc) { %> <%- include('toc_item', {entry, active}) %> <% active = false %> <% } %>
<% } %>