Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
html-toc-generator
Advanced tools
The Table of Contents Generator is a JavaScript library that generates a table of contents based on the headings (e.g., ``, ``, ``) within an HTML document. It provides options for customizing the generated table of contents.
The Table of Contents Generator is a JavaScript library that generates a table of contents based on the headings (e.g., <h1>
, <h2>
, <h3>
) within an HTML document. It provides options for customizing the generated table of contents.
You can install the Table of Contents Generator library using npm:
npm install html-toc-generator
To use the Table of Contents Generator in your project, follow these steps:
import TableOfContents from 'html-toc-generator';
TableOfContents
class:const options = {
attributes: ['h1', 'h2', 'h3'],
appendTo: 'body',
containerClassName: 'toc',
ordered: false,
contentSelector: '#content'
};
const tableOfContents = new TableOfContents(options);
init
method to generate the table of contents:tableOfContents.init();
The TableOfContents
class accepts an optional options
object during initialization. The available options are:
Option | Type | Default Value | Optional | Description |
---|---|---|---|---|
attributes | string[] | ['h1', 'h2', 'h3'] | Yes | An array of HTML heading tag names to include in the table of contents. |
appendTo | string | 'body' | Yes | The selector of the element to which the table of contents should be appended. |
containerClassName | string | 'toc' | Yes | The CSS class name to be applied to the container element of the table of contents. |
ordered | boolean | false | Yes | A boolean value indicating whether the generated table of contents should be ordered or unordered. |
contentSelector | string | '#content' | Yes | The selector of the element containing the content to generate the table of contents from. |
s |
This project is licensed under the MIT License.
FAQs
The Table of Contents Generator is a JavaScript library that generates a table of contents based on the headings (e.g., ``, ``, ``) within an HTML document. It provides options for customizing the generated table of contents.
The npm package html-toc-generator receives a total of 0 weekly downloads. As such, html-toc-generator popularity was classified as not popular.
We found that html-toc-generator demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.