
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@danielhaim/autotoc
Advanced tools
NPM package for generating and managing table of contents with scroll highlighting for web content
AutoTOC
is an NPM package for automatically generating and managing table of contents with scroll highlighting for web content
To initiate, install AutoTOC
using NPM:
npm i @danielhaim/autotoc
import AutoToc from "@danielhaim/autotoc";
document.addEventListener("DOMContentLoaded", function () {
const tocOptions = {
contentSelector: "article",
navigationContainer: "nav",
tocTitle: "Table of Contents",
tocIcon: '<i class="your-icon-class"></i>',
highlightOffset: 100,
headingDepthLimit: 4
};
// Appends to Top
const externalLinksTop = [
{ id: "external-link1", text: "Custom Top Link 1" },
{ id: "external-link2", text: "Custom Top Link 2" }
];
// Appends to Bottom
const externalLinksBottom = [
{ id: "external-link3", text: "Custom Bottom Link 3" },
{ id: "external-link4", text: "Custom Bottom Link 4" }
];
try {
const tocGenerator = new AutoToc.Generate(
...Object.values(tocOptions)
);
tocGenerator.addExternalLinksToToc(externalLinksTop, "top", "level-0");
tocGenerator.addExternalLinksToToc(externalLinksBottom, "bottom", "level-0");
tocGenerator.initialize();
} catch (error) {
console.error("An error occurred:", error.message);
}
});
FAQs
NPM package for generating and managing table of contents with scroll highlighting for web content
The npm package @danielhaim/autotoc receives a total of 2 weekly downloads. As such, @danielhaim/autotoc popularity was classified as not popular.
We found that @danielhaim/autotoc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.