<%
const isExternalLink = note.hasLabel('shareExternalLink');
const linkHref = isExternalLink ? note.getLabelValue('shareExternalLink') : `./${note.shareId}`;
const target = isExternalLink ? ` target="_blank" rel="noopener noreferrer"` : '';
%>
<p>
    <% const titleWithPrefix = (branch.prefix ? `${branch.prefix} - ` : '') + note.title; %>

    <% if (activeNote.noteId === note.noteId) { %>
    <strong><%= titleWithPrefix %></strong>
    <% } else { %>
    <a class="type-<%= note.type %>" href="<%= linkHref %>"<%= target %>><%= titleWithPrefix %></a>
    <% } %>
</p>

<% if (note.hasChildren()) { %>
<ul>
    <% note.getVisibleChildBranches().forEach(function (branch) { %>
        <li>
            <%- include('tree_item', {branch: branch, note: branch.getNote()}) %>
        </li>
    <% }) %>
</ul>
<% } %>
