@codedoc/core
Version:
Create beautiful modern documentation websites.
25 lines • 1.22 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContentNav = void 0;
var style_1 = require("./style");
function ContentNav(options, renderer) {
var classes = this.theme.classes(style_1.ContentNavStyle);
var links = [];
options.content.querySelectorAll('h1[id], h2[id], h3[id], h4[id], h5[id], h6[id]').forEach(function (h$) {
var text = h$.textContent;
if (h$.childElementCount > 0) {
text = '';
h$.childNodes.forEach(function (node) {
if (!(node instanceof HTMLElement && node.hasAttribute('data-ignore-text'))) {
text += node.textContent || '';
}
});
}
links.push(renderer.create("a", { href: "#" + h$.getAttribute('id'), class: h$.tagName.toLowerCase(), "data-content-highlight": h$.getAttribute('id') }, text));
});
return renderer.create("div", { class: classes.contentnav, "data-no-search": true }, links);
}
exports.ContentNav = ContentNav;
var style_2 = require("./style");
Object.defineProperty(exports, "ContentNavStyle", { enumerable: true, get: function () { return style_2.ContentNavStyle; } });
//# sourceMappingURL=index.js.map